How to signal kernel that shared library is not in use by any process anymore ?

How to signal kernel that shared library is not in use by any process anymore ?

Lev Olshvang levonshe at yandex.com
Fri Dec 21 16:20:36 IST 2018


Hi All,

I have  an executable (C++) which is the exclusive user of the some shared library that it uses only during  the initialization phase.

I would like to free memory used by this shared library, because I am running on embedded system.

How can I achieve this?

I know that dlopen() will load shared library, and hope that following dlclose() will free this lib memory. 

1. Still  I do not know what method should be used to make dynamic linker look again into executable and resolve symbols of the newly appeared symbols ?
2. And  how to tell the dynamic linker ld-linux.so to postpone the symbol resolution until dlopen()  will load  the library?
3. Whether to compile and link executable with this library or leave unresolved symbols?

Waiting for your advises,
Lev.



More information about the Linux-il mailing list