cynthia / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

the tcmalloc can't auto repalce “malloc” and "free" with release mode under windows, but can with debug mode #427

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Build libtcmalloc_minimal with release mode;
2.Copy libtcmalloc_minimal.dll and libtcmalloc_minimal.lib to my test solution 
dir;
2.Copy the "tcmalloc.h" too;
3.Add link libtcmalloc_minimal.lib and use __tcmalloc;
4.build my test project with release mode. 

What version of the product are you using? On what operating system?

Version: gperftools-2.0.

Please provide any additional information below.

My IDE is vs2005, and I build my test solution with release mode,
I find that the "malloc" and "free" funtion is the old one, had not be instead 
of "tc_malloc" and "tc_free".

But it's ok if I build my test solution with debug mode

Original issue reported on code.google.com by kakarot1...@gmail.com on 29 Apr 2012 at 8:03

GoogleCodeExporter commented 9 years ago
Interesting issue. Sounds like in release mode the linker isn't pulling in the 
tcmalloc library. Try referencing a symbol from tcmalloc.h in your program and 
rebuild. That will at least guarantee tha the linker will have to pull in 
libtcmalloc.

Original comment by chapp...@gmail.com on 3 May 2012 at 3:10

GoogleCodeExporter commented 9 years ago
I find that it can be successful in release mode if the run time library is set 
"MD" or "MDD", but it's failed if set "MT" or "MTD".

Must the run time library be set "MD" or "MDD"?

thanks.

Original comment by kakarot1...@gmail.com on 9 May 2012 at 3:21

GoogleCodeExporter commented 9 years ago
I only have access to Visual Studio Express 2012. And never seen this issue.

We merged few fixes recently and they are part of 2.1 release. Please re-test 
and reopen if problem still happens. With test program please.

Original comment by alkondratenko on 14 Sep 2013 at 8:26