Type Function Library (globals) Return value none Revision Current Public Release (2013.2100) Keywords garbage collection, garbage, memory, resources Sample code none See also
A generic interface to Lua's garbage collector. Using this function is not required because Lua has automatic garbage-collection features. More information here.
collectgarbage( [opt [, arg]] )
String. Performs garbage-collection functions differently based on this option. See Possible values for
opt section for a complete listing. The default (if this argument is omitted) is: "collect"
Any. Arguments that are directly related to the value you chose for
opt. Many options do not need arguments to be passed.
The following is a list of accepted strings for the
arg(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
trueif the step finished a collection cycle.
argas the new value for the pause of the collector. Returns the previous value for pause.
argas the new value for the step multiplier of the collector. Returns the previous value for step.