lua_gc
— controls
the garbage collector, function indicator [-0, +0, e]
#include
<lua.h>
int
lua_gc
(lua_State
*L, int what,
int data);
lua_gc
()
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 as the new value for the pause of the collector. The function
returns the previous value of the pause.
LUA_GCSETSTEPMUL
:
- sets data as the new value for the step multiplier of the collector. The
function returns the previous value of the step multiplier.
Roberto Ierusalimschy,
Luiz Henrique de Figueiredo, and
Waldemar Celes, Lua 5.1 Reference
Manual.
The lua_gc
() manual page is based on Lua
Reference Manual 5.1 and was created by Sergey Bronnikov.