Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link problem in tcmalloc_minimal when using Debug-override configuration using Visual Studio on windows. #1430

Open
muliu opened this issue Sep 9, 2023 · 0 comments
Labels

Comments

@muliu
Copy link

muliu commented Sep 9, 2023

Downloaded the latest gperftools 2.12 from github, built it configured it with Debug-Override x86 on windows using VisualStudio 2022。

The Debug-Override configuration is newly created by me. It is copied from Release-Override, except for the following configuration items:

  • c/c++ - Optimization - Optimization: Use “Disabled (/Od)” instead of “Maximum Optimization (Favor Speed) (/O2)”
  • c/c++ - Preprocessor - Preprocessor Definitions: Use “_DEBUG” instead of “NDEBUG”
  • c/c++ - Code Generation - Runtime Library: Use “Multi-threaded Debug (/MTd)” instead of “Multi-threaded (/MT)”

Link Debug-Override libtcmalloc_minimal.lib in statically with a Console APP for test purpose. Build the test app, the output is:

Build started...
1>------ Build started: Project: tcm_s, Configuration: Debug Win32 ------
1>G:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v150\Platforms\Win32\PlatformToolsets\v141_xp\Toolset.targets(39,5): warning MSB8051: Support for targeting Windows XP is deprecated and will not be present in future releases of Visual Studio. Please see https://go.microsoft.com/fwlink/?linkid=2023588 for more information.
1>tcm_s.cpp
1>libucrtd.lib(debug_heap.obj) : error LNK2005: __calloc_dbg already defined in libtcmalloc_minimal.lib(override_functions.obj)
1>libucrtd.lib(debug_heap.obj) : error LNK2005: __free_dbg already defined in libtcmalloc_minimal.lib(override_functions.obj)
1>libucrtd.lib(debug_heap.obj) : error LNK2005: __malloc_dbg already defined in libtcmalloc_minimal.lib(override_functions.obj)
1>C:\Users\muliu\Desktop\hub\tcm_s\Debug\tcm_s.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Done building project "tcm_s.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 11:01 and took 03.951 seconds ==========

My guess is that the malloc, free and calloc of the Debug version have not been hooked, right?

link2

link

perftools

test app

@alk alk added the windows label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants