pub fn collectgarbage(opt: option<string>) -> anyExpand description
A generic interface to the garbage collector. Performs different jobs
according to opt: "collect" runs a full collection cycle (the
default), "stop" and "restart" pause and resume the collector,
"count" returns the total memory in use by Lua in kilobytes,
"step" performs an incremental step, "isrunning" tells whether
the collector is stopped, and "incremental" / "generational"
select the collector mode.
Changed in Lua 5.5: collector parameters are read and set through
the new "param" option โ collectgarbage("param", name [, value])
โ where name is one of "pause", "stepmul", "stepsize" (for
the incremental collector) or "minormul", "minormajor",
"majorminor" (for the generational collector). In 5.5 major
collections of the generational collector are done incrementally.
ยงExamples
print(collectgarbage("count")) --> 24.35 (kilobytes in use)
collectgarbage() -- run a full collection cycle