Difference between revisions of "Collectgarbage"

From GiderosMobile
Line 3: Line 3:
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate>This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt:  
+
<translate>This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt:
 
<ul>
 
<ul>
 
<li>"stop": stops the garbage collector. </li>
 
<li>"stop": stops the garbage collector. </li>
Line 15: Line 16:
 
</ul></translate>
 
</ul></translate>
 
<source lang="lua">
 
<source lang="lua">
collectgarbage(opt,arg)
+
collectgarbage(opt,arg)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''opt''': (string) <translate>command for garbage collector mechanism</translate> <br/>
 
'''opt''': (string) <translate>command for garbage collector mechanism</translate> <br/>
 
'''arg''': (varies) <translate>additional parameters for command</translate> '''optional'''<br/>
 
'''arg''': (varies) <translate>additional parameters for command</translate> '''optional'''<br/>
 +
 +
{{(global)}}

Revision as of 03:59, 11 February 2020


Available since: Gideros 2011.6
Class: (global)

Description

This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt:

  • "stop": stops the garbage collector.
  • "restart": restarts the garbage collector.
  • "collect": performs a full garbage-collection cycle.
  • "count": returns the total memory in use by Lua (in Kbytes).
  • "step": performs a garbage-collection step. The step "size" is controlled by 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.
  • "setpause": sets arg as the new value for the pause of the collector. Returns the previous value for pause.
  • "setstepmul": sets arg as the new value for the step multiplier of the collector. Returns the previous value for step.
collectgarbage(opt,arg)

Parameters

opt: (string) command for garbage collector mechanism
arg: (varies) additional parameters for command optional