[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Module finalization (along the lines of calling a function on exit)
- From: David Burgess <dburgess@...>
- Date: Tue, 23 Aug 2005 10:29:56 +1000
Lua 5.1 does unload modules. This happens at lua_close().
The reason why you need it in Win32 is for code like:
while (some condition) { /* runs for 2 months */
L = lua_open();
stuff(); /* calls lua_pcall */
lua_close();
}
If the pcall()ed code executes LoadLibrary() without executing FreeLibrary()
we may have a never ending increase in the number of open handles.
If the library being loaded is something like Luasocket which (for Win32)
needs to issue paired WSAStartup()/WSACleanup() calls this becomes
even more critical.
David B
Rici Lake wrote:
> Lua does not ever unload modules, so the "somehow" question here is
> pretty important :) Lua doesn't call luaopen_XXX automatically, either.
> But I'm still not convinced that unloading dynamic modules is a good
> idea