lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thursday 03 February 2011 6:00:55 pm Luiz Henrique de Figueiredo wrote:
> > Is there any way to unload a shared library after is has been loaded by require()?
> 
> See unrequire in http://lua-users.org/lists/lua-l/2009-03/msg00587.html
> 
> You may need to collect gargage after calling unrequire.
> 
> 

That's basically what I did, but the C shared library still seems to be loaded in the memory and pmap still shows that it's there.

"unrequire" successfully removes the Lua visible references to a C shared library, but it doesn't actually unload it from the memory. From what I can tell, ll_unloadlib() is only called when the userdata with the shared library handle is GC'ed ( which usually is when the Lua state is closed, since the userdata is in the registry )

Peter