简体   繁体   English

如果从dlopen'd库中调用dlopen(),是否存在负载泄漏?

[英]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. 如果我的可执行文件调用dlopen来加载库但忽略调用dlclose ,则库将保持加载状态,直到进程退出并且操作系统强制它卸载。

If I load a.so which loads b.so , then call dlclose on a.so , does the OS unload b.so as well? 如果我加载a.so加载b.so ,然后在a.so上调用dlclose ,操作系统b.so卸载b.so吗?

How does this compare with a similar scenario using the Microsoft equivalent, LoadLibraryEx ? 这与使用Microsoft等效的LoadLibraryEx的类似场景相比如何?

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 . 如果你加载a.so ,你需要关心的是卸载a.so

If a.so refuses to unload b.so , that is a problem with a.so , your app is not responsible for this. 如果a.so拒绝卸载b.so ,这是一个问题a.so ,您的应用程序是不负责。 The author of a.so needs to get their act together and fix the problem with their library. a.so的作者需要一起行动并解决他们的库的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM