AdvancedCreates a new RenderableGCSystem instance.
The renderer this garbage collection system works for
Maximum time in ms a resource can be unused before being garbage collected
StaticdefaultDefault configuration options for the garbage collection system. These can be overridden when initializing the renderer.
Gets whether the garbage collection system is currently enabled.
True if GC is enabled, false otherwise
Enables or disables the garbage collection system. When enabled, schedules periodic cleanup of resources. When disabled, cancels all scheduled cleanups.
Adds an array to be managed by the garbage collector.
The object containing the array
The property name of the array
Adds a hash table to be managed by the garbage collector.
The object containing the hash table
The property name of the hash table
Cleans up the garbage collection system. Disables GC and removes all tracked resources.
Initializes the garbage collection system with the provided options.
Configuration options for the renderer
Performs garbage collection by cleaning up unused renderables. Removes renderables that haven't been used for longer than maxUnusedTime.
The RenderableGCSystem is responsible for cleaning up GPU resources that are no longer being used.
When rendering objects like sprites, text, etc - GPU resources are created and managed by the renderer. If these objects are no longer needed but not properly destroyed (via sprite.destroy()), their GPU resources would normally leak. This system prevents that by automatically cleaning up unused GPU resources.
Key features:
Best practices:
Example
Deprecated
since 8.15.0