collectgarbage ([opt [, arg]])
This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt
:
-
"
collect
": performs a full garbage-collection cycle. This is the default option. -
"
stop
": stops automatic execution of the garbage collector. The collector will run only when explicitly invoked, until a call to restart it. -
"
restart
": restarts automatic execution of the garbage collector. -
"
count
": returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 gives the exact number of bytes in use by Lua (except for overflows). -
"
step
": performs a garbage-collection step. The step "size" is controlled byarg
. With a zero value, the collector will perform one basic (indivisible) step. For non-zero values, the collector will perform as if that amount of memory (in KBytes) had been allocated by Lua. Returns true if the step finished a collection cycle. -
"
setpause
": setsarg
as the new value for the pause of the collector (see §2.5). Returns the previous value for pause. -
"
setstepmul
": setsarg
as the new value for the step multiplier of the collector (see §2.5). Returns the previous value for step. -
"
isrunning
": returns a boolean that tells whether the collector is running (i.e., not stopped).
Please login to continue.