Three paths in the 3D stage dropped objects without releasing what they
held on the GPU:
- Scene.clear() (New Scene) assigned `scene.children = []`, which
disposed nothing and left each child parented to the scene. Every New
Scene leaked all geometries, materials, textures and splat buffers of
the previous one.
- SceneUtils.deleteObject disposed geometries and materials but not the
textures they reference (Material.dispose() does not free its maps),
so deleting a textured GLB leaked every map.
- _create_skybox replaced scene.background without disposing the
previous cube texture.
Add disposeObject3D(), which frees geometries, materials and their
textures (deduplicated), skeleton bone textures and Spark splat buffers,
and use it in clear() and deleteObject. clear() now uses Object3D.clear()
so children are actually unparented. The old deleteObject also checked a
custom `.texture` field that nothing in the codebase sets; that branch
is dropped.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>