This is the mail archive of the 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: Alloc duplicate

On Thu, May 15, 2014 at 10:45:39AM -0400, Martin Brandenburg wrote:
> I am using mtrace to debug memory leaks in a program. I am getting
> output of the following form from mtrace:
>         + 0x00000000024097d0 Alloc 1219709 duplicate: 0x4b372b
> /opt/orangefs/sbin/pvfs2-server:(dbpf_queued_op_alloc+0xe)[0x4b372b]
> Reading the raw log it looks like the same pointer is allocated twice.
> The program is multi-threaded, so I've thought about that as a reason.
> There are some notes that mtrace(3) uses malloc_hook(3) and that
> malloc_hook does not work well in a multithreaded environment. Is this
> the cause of the problem? Does this output indicate a bug in my program
> or just a problem with mtrace in multithreaded systems? The rest of the
> output is still useful.
It is probably problem in mtrace, it should not be used in multithread

Most likely scenario is that thread A allocated and freed a pointer but
was suspended before it flushed output containing free. Then thread B
allocated same pointer flushed that allocation before thread A could
flush its buffer.

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