Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a load leak if dlopen() is called from a dlopen'd library?

If my executable calls dlopen to load a library but neglects to call dlclose, the library will stay loaded until the process exits and the OS forces it to unload.

If I load a.so which loads b.so, then call dlclose on a.so, does the OS unload b.so as well?

How does this compare with a similar scenario using the Microsoft equivalent, LoadLibraryEx?

like image 819
Kietz Avatar asked Jan 14 '15 20:01

Kietz


1 Answers

The application need only worry about what the app loads directly. If you load a.so, all you need to be concerned with is unloading a.so.

If a.so refuses to unload b.so, that is a problem with a.so, your app is not responsible for this. The author of a.so needs to get their act together and fix the problem with their library.

like image 100
PaulMcKenzie Avatar answered Oct 07 '22 01:10

PaulMcKenzie