[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libltdl leaks when unloading plugins depending on external lib

From: Brice Goglin
Subject: Re: libltdl leaks when unloading plugins depending on external lib
Date: Tue, 03 Apr 2012 23:26:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20111114 Icedove/3.1.16

Le 03/04/2012 23:13, Bob Friesenhahn a écrit :
> On Tue, 3 Apr 2012, Brice Goglin wrote:
>> I am fixing leaks in one of my software projects that embeds libltdl
>> 2.4.2 to load plugins. I noticed that when the plugin depends on the
>> dynamic library that the main program doesn't depend on, valgrind
>> reports some leaks.
> If the main program is directly linked with -lpthread do some leaks go
> away (or more are added)?

Everything goes away, but a new one appears. Anyway, see below.

>> We created a small testcase reproducing the problem. It's available at
>> Just download it, ./configure, make, make install and then run valgrind
>> as shown below.
>> If we remove the reference to pthread in the plugin, the leaks go away.
>> I assume that libltdl doesn't unload these dependency libraries when the
>> plugin is unloaded. But I'd like to know if these leaks are expected or
>> not. The good news is that these leaks do not depend on the number of
>> times this code is executed within the program, so the leaked size
>> should be constant.
> These reported leaks seem to be due to the glibc implementation and
> don't look like libltdl's fault.  It is interesting to me that these
> reported leaks are different than I have seen before.  Usually I see
> leaks reported for thread-specific errno and thread specific data.
> It is common for glibc to secretly allocate some memory for its own
> use, and this is particularly true for multi-threaded programs.  Often
> it has no way to safely release this memory.

I tried with another dependency (libpci instead of libpthread), the
leaks go away, so indeed the problem is likely outside of libltdl.

Thanks and sorry for the noise!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]