dispose method
void
dispose()
Releases the native context, its instance children and effect slots, this player's hold on the pack and the render backend. Idempotent.
Implementation
void dispose() {
if (_disposed) return;
_disposed = true;
// The backend owns the coverage bitmap + shader pools (and any GPU
// resources); release them.
_backend.dispose();
// The slots borrow the pack's resource; they must go first. Instance
// children own their own Context and hold on the pack, and are torn down
// recursively from here.
_effects.dispose();
_instances.dispose();
// Decoded atlases are native bitmap memory the GC cannot see, so a dropped
// registry leaks a full texture set per load. Children share ours and have
// already run their own dispose above with `_ownsTextures == false`.
if (_ownsTextures) textures.dispose();
ssRuntime.unregisterFromGc(this);
ssRuntime.destroyContext(_context);
_pack.close();
}