This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mtrace perl tool reporting "+ 0x000001003c393dc0 Alloc 3183 duplicate: 0x3fffaa678d08 /lib64/libntirpc.so.1.3:[0x3fffaa678d08]"


Malahal Naineni <malahal@gmail.com> writes:
> I am using matrace to find out a memory leak in a long running server
> application. Why do I get the above warning/error? Using
> glibc-2.17-222.el7 package from Redhat if that matters. The
> applications is a multi-threaded application.

This basically says "you've already allocated this, and I didn't see a
free()" which *seems* like malloc() is returning the same address twice.
In reality, it's more likely (assuming something hasn't actually broken)
that threads are doing malloc operations in one order, but reporting
them in a different order, so the mtrace tool sees a malloc() return a
pointer just before the free() that had free'd it, instead of
free-then-malloc.

i.e. the program does this:

x = malloc(sz);
free (sz);
x = malloc(sz); /* returns same value */

but the *logs* say something like this:

+ MALLOC 0x1234
+ MALLOC 0x1234
- FREE 0x1234

Having said that, something could be broken for any number of weird
reasons (example: a lost record, data corruption, etc), and knowing for
sure what the problem is would require poring over your logs for hours
trying to figure out what actually happened.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]