int lua_gc (lua_State *L, int what, int data);
Controls the garbage collector.
This function performs several tasks, according to the value of the parameter what
:
LUA_GCSTOP
: stops the garbage collector.
LUA_GCRESTART
: restarts the garbage collector.
LUA_GCCOLLECT
: performs a full garbage-collection cycle.
LUA_GCCOUNT
: returns the current amount of memory (in Kbytes) in use by Lua.
LUA_GCCOUNTB
: returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024.
LUA_GCSTEP
: performs an incremental step of garbage collection. The step "size" is controlled by data
(larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of data
. The function returns 1 if the step finished a garbage-collection cycle.
LUA_GCSETPAUSE
: sets =data=/100 as the new value for the pause of the collector (see Garbage Collection). The function returns the previous value of the pause.
LUA_GCSETSTEPMUL
: sets =arg=/100 as the new value for the step multiplier of the collector (see Garbage Collection). The function returns the previous value of the step multiplier.