lua-users home
lua-l archive

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

Graham Wakefield wrote:
> Another thought - is it possible to get some kind of callback from a
> lua_State when it is collected?  This would allow me to free C
> resources attached to it and prevent my memory leak.  Something like
> a __gc method for states created via lua_newthread.

Take a look at luai_userstatefree, defined (to nothing) in luaconf.h. This
hook is called when a lua_State (including the master state) is being