This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Debugging memory leaks using mtrace()
- From: "Eduard Wirch" <ew at omikron dot net>
- To: <libc-help at sourceware dot org>
- Date: Wed, 1 Oct 2008 09:20:48 +0200
- Subject: Debugging memory leaks using mtrace()
Hi
I'm trying to debug a memory leak problem. I'm using mtrace() to get a
malloc/free/realloc trace. I've ran my prog and have now a huge log
file. So far so good. But I have problems interpreting the file. Look at
these lines:
@ /usr/java/ibm-java2-x86_64-50/jre/bin/libj9prt23.so:[0x2b270a384a34] +
0x1502570 0x68
@ /usr/java/ibm-java2-x86_64-50/jre/bin/libj9prt23.so:[0x2b270a384a34] +
0x1502620 0x30
@ /usr/java/ibm-java2-x86_64-50/jre/bin/libj9prt23.so:[0x2b270a384a34] +
0x2aaab43a1700 0xa80
@ /usr/java/ibm-java2-x86_64-50/jre/bin/libj9prt23.so:[0x2b270a384a34] +
0x1501460 0xa64
The strange about this is that one call (same return address) is
responsible for 4 allocations.
Even stranger:
@ /usr/java/ibm-java2-x86_64-50/jre/bin/libj9prt23.so:[0x2b270a384a34] +
0x2aaab43a1700 0xa2c
...
@ /usr/java/ibm-java2-x86_64-50/jre/bin/libj9prt23.so:[0x2b270a384a34] +
0x2aaab43a1700 0xa80
Between those two lines the block 0x2aaab43a1700 is never being freed.
Does anyone have an explanation for this? How could one call result in 4
allocations. And how could malloc return an address which was already
allocated previously?
Bye