dlclose() doesn't call dtor for some .so files

Mike Frysinger vapier@gentoo.org
Tue Jul 17 04:55:00 GMT 2012


On Monday 16 July 2012 23:56:43 Skunk Worx wrote:
> I am running into the same problem described in the following thread :
> 
> http://gcc.gnu.org/ml/gcc-help/2011-05/msg00403.html
> 
> The destructor doesn't get called when the library is dlclose()'d.
> 
> The linked thread suggests that this may be a glibc issue.

as the spec says, this high level description does not in and of itself 
indicate a bug.  dlopen() is not required to immediately unload the object 
from memory (and thus call the deconstructor routines).  it is purely an 
advisory function that tells the C library the application is done with it.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlclose.html

glibc won't fully unload the object until it is no longer in use.  i imagine 
if you look at the process's /proc/<pid>/maps file, you'll see that it's still 
loaded.  as to why glibc is flagging it as still in use, that is the question 
to find out.  you could try using LD_DEBUG=all and see what kind of output you 
get.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-help/attachments/20120717/3d917f20/attachment.sig>


More information about the Libc-help mailing list