Kietz
Kietz

Reputation: 1406

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?

Upvotes: 6

Views: 251

Answers (1)

PaulMcKenzie
PaulMcKenzie

Reputation: 35455

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.

Upvotes: 3

Related Questions