Type Function Library (globals) Return value none Revision Current Public Release (2013.1076) 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.
optThe following is a list of accepted strings for the opt argument:
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 arg. Returns true if the step finished a collection cycle.arg as the new value for the pause of the collector. Returns the previous value for pause.arg as the new value for the step multiplier of the collector. Returns the previous value for step.