Interface to the Lua garbage collector
See also Lua library functions.
Signature:
collectgarbage(option
[,
arg])
Arguments:
option
- One of the following optionscollect
- Performs a full garbage collection cyclecount
- Returns the total Lua memory usage (in kilobytes)restart
- Restarts the garbage collectorsetpause
- Sets the garbage collector's pause percentage toarg
; e.g., if 200, the collector waits for memory usage to double before starting a new cyclesetstepmul
- Sets the garbage collector's speed (as a percentage relative to memory allocation) toarg
; e.g., if 200, the collector runs twice as fast as memory is allocatedstep
- Performs a garbage collection step, with sizearg
stop
- Stops the garbage collector
arg
- Argument applicable to some options
This function is defined in the Lua standard libraries