caohaiwd / gperftools

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

tcmalloc_debug leaks memory #202

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write a simple program that otherwise has no memory leaks.
2. Link against tcmalloc_debug
3. Run the program after turning on the heapchecker.

What is the expected output? What do you see instead?

The heapchecker should report no leaks (as is when one links against 
tcmalloc). However, when linked against tcmalloc_debug, the heapchecker 
reports the following leaks:

Leak check _main_ detected leaks of 8 bytes in 1 objects
The 1 largest leaks:
Leak of 8 bytes in 1 objects allocated from:
    @ 0x2ac7c0ac976e TCMallocGuard::TCMallocGuard
    @ 0x2ac7c0adf1bc global constructors keyed to heap_profiler.cc
    @ 0x2ac7c0ae4656 __do_global_ctors_aux
    @ 0x2ac7c0ac581b _init

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

perfools 1.4. Ubuntu 9.10, x86_64 CPU.

Please provide any additional information below.

Original issue reported on code.google.com by mohit.a...@gmail.com on 30 Dec 2009 at 10:03

GoogleCodeExporter commented 9 years ago
Interesting, I just got another report about this yesterday!  I guess it's 
fairly new, 
though, since it only happens in the new debug mode.  We'll figure out a fix 
for the 
next release.

Original comment by csilv...@gmail.com on 30 Dec 2009 at 5:44

GoogleCodeExporter commented 9 years ago
the bug still exist.
my output is:

$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o malloc_test.o -c -g malloc_test.cc
g++ -o malloc_test malloc_test.o -Wl,-Bstatic -ltcmalloc_debug -Wl,-Bdynamic
scons: done building targets.

$ ./malloc_test 
WARNING: Perftools heap leak checker is active -- Performance may suffer
Found leaks without pointer alignment as well: unaligned pointers must not be 
the 
cause of leaks.
--heap_check_test_pointer_alignment did not help to diagnose the leaks.
Leak check _main_ detected leaks of 8 bytes in 1 objects
The 1 largest leaks:
Leak of 8 bytes in 1 objects allocated from:
        @ 804e03b TCMallocGuard
        @ 804e0d9 __static_initialization_and_destruction_0
        @ 804e3d0 global constructors keyed to 
_ZN61FLAG__namespace_do_not_use_directly_use_DECLARE_int64_instead43FLAGS_tcmall
oc_la
rge_alloc_report_thresholdE
        @ 80755bd __do_global_ctors_aux
        @ 804bd14 _init
        @ 8075519 __libc_csu_init
        @ b7c903ec __libc_start_main
        @ 804c481 _start

If the preceding stack traces are not enough to find the leaks, try running 
THIS 
shell command:

pprof ./malloc_test "/tmp/malloc_test.6247._main_-end.heap" --inuse_objects 
--lines -
-heapcheck  --edgefraction=1e-10 --nodefraction=1e-10 --gv

If you are still puzzled about why the leaks are there, try rerunning this 
program 
with HEAP_CHECK_TEST_POINTER_ALIGNMENT=1 and/or with 
HEAP_CHECK_MAX_POINTER_OFFSET=-1
If the leak report occurs in a small fraction of runs, try running with 
TCMALLOC_MAX_FREE_QUEUE_SIZE of few hundred MB or with 
TCMALLOC_RECLAIM_MEMORY=false, it might help find leaks mo
Exiting with error code (instead of crashing) because of whole-program memory 
leaks

Original comment by egametang@gmail.com on 21 Jan 2010 at 7:53

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry about that -- we had a fix set for last release, but it caused some 
problems so
we backed it out, and then never got around to doing a better fix.  I'll work 
on that
now, with the goal of getting it into the next release.

Original comment by csilv...@gmail.com on 4 Feb 2010 at 12:09

GoogleCodeExporter commented 9 years ago
This should be fixed in perftools 1.6, just released.

Original comment by csilv...@gmail.com on 5 Aug 2010 at 8:46