samskalicky opened a new pull request #20523: URL: https://github.com/apache/incubator-mxnet/pull/20523
## Description ## stop closing opened libs. fixes #20411 using portions already merged into master/2.0 in #19016. According to [[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/dlclose.html) > The dlclose() function shall inform the system that the object referenced by a handle returned from a previous dlopen() invocation is no longer needed by the application. > The use of dlclose() reflects a statement of intent on the part of the process, but does not create any requirement upon the implementation, such as removal of the code or symbols referenced by handle. So calling `dlclose` is just a suggestion to the OS that it could close the library. But the OS may not do anything (ie. and wait until the process exits to clean up any opened handles). Im thinking we might as well just let it be cleaned up anyway rather than calling `dlclose` at all. As suggested in [[2]](https://stackoverflow.com/a/26131259) > If you only ever open one library, use it throughout your program, then calling dlclose just before you exit is probably not essential, but if you open a lot of libraries (e.g. using some sort of plugin in a long-running program that can/will use many different plugins, the program may run out of virtual address space if you don't call dlclose. > (All shared libraries are closed on exit anyway, so leaving it open at exit should not be an issue) So if a user was loading/unloading a bunch of libraries at runtime they might want to close some they dont need anymore. However, since MXNet registers components from the library (ie. operators, partitioners, graph passes, etc) and has NO capability to unregister them the references to the loaded library will live at least as long as MXNet (ie. libmxnet.so) does. MXNet already has quite a few components (or its dependencies like TVM/NNVM) that live forever and require the OS to clean them up when the process exits. So its not possible to close libmxnet.so and assume everything is cleaned up. We might as well do the same thing for custom libraries. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
