Closed GoogleCodeExporter closed 9 years ago
=========================================== main.c: ------------------------------------------- #include <google/tcmalloc.h> int mallocTest() { int len = 1000; char* buffer = (char*) tc_malloc(len); for (int i = 0; i < len; i++) { buffer[i] = char(i % 255); } tc_free(buffer); } int main(int argc, char ** argv) { return mallocTest(); } ====================================== build scripts: -------------------------------------- gcc -c main.cpp -o ./main.o gcc -o ./test ./main.o -ltcmalloc ====================================== run script: -------------------------------------- HEAPCHECK=normal ./test ====================================== gdb info: -------------------------------------- HEAP_CHECK_RUN_UNDER_GDB=true gdb ./test #0 0x00007ffff786a020 in nanosleep () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007ffff7b9add9 in base::internal::SpinLockDelay (w=0x7ffff7db32a0, value=2, loop=3196) at ./src/base/spinlock_linux-inl.h:89 #2 0x00007ffff7b9b062 in SpinLock::SlowLock (this=0x7ffff7db32a0) at src/base/spinlock.cc:132 #3 0x00007ffff7b8494c in Lock (this=0x7ffff7db32a0) at src/base/spinlock.h:75 #4 SpinLockHolder (l=0x7ffff7db32a0, this=0x7fffffffc3e0) at src/base/spinlock.h:141 #5 NewHook (ptr=0x716000, size=256) at src/heap-checker.cc:577 #6 0x00007ffff7b9317a in MallocHook::InvokeNewHookSlow (p=0x716000, s=256) at src/malloc_hook.cc:525 #7 0x00007ffff7ba06cb in InvokeNewHook (s=256, p=0x716000) at src/malloc_hook-inl.h:161 #8 do_realloc_with_callback (invalid_get_size_fn=<optimized out>, invalid_free_fn=<optimized out>, new_size=<optimized out>, old_ptr=<optimized out>) at src/tcmalloc.cc:1221 #9 do_realloc (new_size=<optimized out>, old_ptr=<optimized out>) at src/tcmalloc.cc:1228 #10 tc_realloc (old_ptr=<optimized out>, new_size=256) at src/tcmalloc.cc:1526 #11 0x00007ffff780466f in _IO_vfscanf () from /lib/x86_64-linux-gnu/libc.so.6 #12 0x00007ffff781d360 in vsscanf () from /lib/x86_64-linux-gnu/libc.so.6 #13 0x00007ffff7808317 in sscanf () from /lib/x86_64-linux-gnu/libc.so.6 #14 0x00007ffff7b9c15b in ProcMapsIterator::NextExt (this=0x7fffffffe080, start=0x7fffffffcc48, end=0x7fffffffcc50, flags=0x7fffffffcc68, offset=0x7fffffffcc58, inode=0x7fffffffcc60, filename=0x7fffffffcc70, file_mapping=0x0, file_pages=0x0, anon_mapping=0x0, anon_pages=0x0, dev=0x0) at src/base/sysinfo.cc:721 #15 0x00007ffff7b9c46f in ProcMapsIterator::Next (this=<optimized out>, start=<optimized out>, end=<optimized out>, flags=<optimized out>, offset=<optimized out>, inode=<optimized out>, filename=0x7fffffffcc70) at src/base/sysinfo.cc:661 #16 0x00007ffff7b872a9 in HeapLeakChecker::UseProcMapsLocked (proc_maps_task=HeapLeakChecker::DISABLE_LIBRARY_ALLOCS) at src/heap-checker.cc:909 #17 0x00007ffff7b879f0 in HeapLeakChecker_InternalInitStart () at src/heap-checker.cc:2032 #18 0x00007ffff7b7f1ec in google_init_module_init_start () at src/heap-checker.cc:2122 #19 GoogleInitializer (dtor=0, ctor=<optimized out>, name=0x7ffff7ba4cba "init_start", this=0x7ffff7db32e0) at src/base/googleinit.h:45 #20 __static_initialization_and_destruction_0 (__initialize_p=<optimized out>, __priority=<optimized out>) at src/heap-checker.cc:2122 #21 _GLOBAL__sub_I_heap_checker.cc(void) () at src/heap-checker.cc:2372 #22 0x00007ffff7de9306 in ?? () from /lib64/ld-linux-x86-64.so.2 #23 0x00007ffff7de93df in ?? () from /lib64/ld-linux-x86-64.so.2 #24 0x00007ffff7ddb6ea in ?? () from /lib64/ld-linux-x86-64.so.2 #25 0x0000000000000001 in ?? () #26 0x00007fffffffe5bd in ?? () #27 0x0000000000000000 in ?? () =========================================== versions: ------------------------------------------- gcc version 4.6.3 Linux vubuntu 3.2.0-29-generic x86_64 gperftools: version 2.0 ===========================================
Original issue reported on code.google.com by zhangpei...@gmail.com on 27 Nov 2012 at 7:41
zhangpei...@gmail.com
Original comment by chapp...@gmail.com on 22 Dec 2012 at 5:51
chapp...@gmail.com
Original issue reported on code.google.com by
zhangpei...@gmail.com
on 27 Nov 2012 at 7:41