LUA_GC(3) Library Functions Manual LUA_GC(3)

lua_gccontrols the garbage collector, function indicator [-0, +0, e]

#include <lua.h>

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:

:
stops the garbage collector.
:
restarts the garbage collector.
:
performs a full garbage-collection cycle.
:
returns the current amount of memory (in Kbytes) in use by Lua.
:
returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024.
:
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.
:
sets data as the new value for the pause of the collector. The function returns the previous value of the pause.
:
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.

July 18, 2022 Debian