Creates a new RenderableGCSystem instance.
Name | Type | Description |
---|---|---|
renderer |
Renderer |
The renderer this garbage collection system works for |
Implements
- {System.<RenderableGCSystemOptions>}
Members
defaultOptions RenderableGCSystemOptions static
Default configuration options for the garbage collection system. These can be overridden when initializing the renderer.
Properties:
Name | Type | Default | Description |
---|---|---|---|
renderableGCActive |
boolean |
true
|
Enable/disable the garbage collector |
renderableGCFrequency |
number |
30000
|
How often to run garbage collection in ms (default 30 seconds) |
renderableGCMaxUnusedTime |
number |
60000
|
Time in ms before an unused resource is collected (default 1 minute) |
Gets whether the garbage collection system is currently enabled.
Enables or disables the garbage collection system. When enabled, schedules periodic cleanup of resources. When disabled, cancels all scheduled cleanups.
Maximum time in ms a resource can be unused before being garbage collected
Methods
Adds an array to be managed by the garbage collector.
Name | Type | Description |
---|---|---|
context |
T |
The object containing the array |
hash |
string |
The property name of the array |
Adds a hash table to be managed by the garbage collector.
Name | Type | Description |
---|---|---|
context |
T |
The object containing the hash table |
hash |
string |
The property name of the hash table |
Starts tracking a renderable for garbage collection.
Name | Type | Description |
---|---|---|
renderable |
Renderable |
The renderable to track |
Cleans up the garbage collection system. Disables GC and removes all tracked resources.
Initializes the garbage collection system with the provided options.
Name | Type | Description |
---|---|---|
options |
RenderableGCSystemOptions |
Configuration options for the renderer |
Updates the GC timestamp and tracking before rendering.
Name | Type | Description |
---|---|---|
options |
RenderOptions |
The render options |
options.container |
The container to render |
Performs garbage collection by cleaning up unused renderables. Removes renderables that haven't been used for longer than maxUnusedTime.