Hacker News new | ask | show | jobs
by yorhel 5041 days ago
On a related note: Be wary of the dlclose() function, it may not necessarily free any resources[1] and not every libc implements it correctly[2].

1. http://www.openwall.com/lists/musl/2012/08/20/1 2. http://www.openwall.com/lists/musl/2012/08/23/20

1 comments

If you really need to demand-load and demand-unload lots and lots and lots of plugins --- and that's the only design I can think of where dlclose matters, but maybe there are others --- fork a plugin host process from the main process, and kill it off when you're done with the plugins. You can use anonymous shared memory to communicate between the two processes (since there's a simple parent/child relationship).