[Bug 2455] New: Leaking memory when continuously dlopen and dlclose shared objects
bugzilla at busybox.net
bugzilla at busybox.net
Fri Aug 27 14:40:59 UTC 2010
https://bugs.busybox.net/show_bug.cgi?id=2455
Summary: Leaking memory when continuously dlopen and dlclose
shared objects
Product: uClibc
Version: 0.9.31
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Shared Library Support
AssignedTo: unassigned at uclibc.org
ReportedBy: ronald.wahl at raritan.com
CC: uclibc-cvs at uclibc.org
Estimated Hours: 0.0
Created attachment 2389
--> https://bugs.busybox.net/attachment.cgi?id=2389
Proposed fix
I noticed some strange memory leak which grows when continuously dlopen and
dlclose shared objects. This happens for example when you use net-snmp with
plugins and reconfigure the daemon by sending a SIGHUP signal. In this case
the modules are unloaded (dlclose) and loaded again (dlopen). After debugging a
bit I found out that in _atexit.c we allocate a new function slot in the
__exit_function_table for each function that should be called on dlclose. That
can be quite a lot functions when using C++ in the module. Now after dlclose
the entries are marked as free again but are not reused on the next dlopen call
which leads to an ever growing __exit_function_table that will be freed only
when the main process exits.
My proposed fix is to zap the largest free block at the end and reuse it. See
the attached patch.
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the uClibc-cvs
mailing list