gc_get_stats

With this function you can retrieve information about the current state of the garbage collector. The function will return a struct which will have the following member variables (note that "objects" here refers to anything that can be garbage collected and not general object instances as defined in the Asset Browser):

NOTE: On the HTML5 target platform garbage collection is handled by the JavaScript engine and therefore the member variables in the above struct will all return 0 if this function is used on that platform.

 

Syntax:

gc_get_stats();

 

Returns:

Struct

 

Example:

if (global.debug == true)
    {
    var _s = gc_get_stats();
    var _t = _s.traversal_time;
    var _c = _s.collection_time;
    show_debug_message("Traversal time = " + string(_t))
    show_debug_message("Collection time = " + string(_c))
    }

The above code checks a global variable and if it is true it gets information from the garabge collector and outputs it to the console as debug messages.