[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: dlopen()/dlclose() and memory reclamation
On Wed, Nov 03, 2010 at 03:20:33PM +0000, Sad Clouds wrote:
> As far as I understand, if an application is linked to a set of
> shared libraries, those libraries are loaded on application's start up,
> or whenever the application references symbols in those libraries. Once
> loaded, they remain in memory until application exits.
The ELF object has a list of DT_NEEDED entries. Those are loaded at
start time including dependencies and remain loaded. You can use
"readelf -d" to show them.
> 2. Application calls dlclose() on libA. For each library that libA
> depends on, ld.so recursively checks their dependencies and if no other
> process is using each of those libraries, those libraries get unmapped.
> Finally, ld.so unmaps libA.
This is what happens. Shared objects use a reference counting garbage
Main Index |
Thread Index |