lua-users home
lua-l archive

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


Hi, it's me again.

I've found luaC_collectgarbage() in lgc.h for explicitly triggering the garbage collector. However, if I understand this correctly, we're only supposed to use the "public" Lua API, i.e. the stuff in lua.h and lualib.h (and lauxlib.h). Is it okay to use this GC call, or am I asking for trouble and making it harder to update to future versions of Lua?

Since my app has several distinct phases, and thus certain clear breaks at which I *know* there will be lots of objects in need of being reclaimed, I'd like to be able to explicitly trigger the GC. People will be waiting between these phases anyway, and thus won't notice the time the GC could take. This function seems to work, but since it's not part of the public API, I fear I may have overlooked some more obvious means of achieving the same. Any clues will be appreciated.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de