Three.js geometry and memory not released after A-Frame entity.remove()
0 reputation · 10 Jul 2020, 19:21 UTC
Goal
Release Three.js GPU memory when A-Frame entities are removed from a long-running scene.
Constraint
entity.remove() detaches the Object3D from the scene graph, but A-Frame does not automatically call dispose() on component geometries, materials, or textures. Repeated add/remove cycles with unique assets can retain GPU memory. Disposing shared resources can break other entities that reference them.
Uncertainty
It is unclear whether component cleanup hooks run reliably before detachment across A-Frame versions, particularly after the 1.x era, and whether the declared project version changes expected behavior.
- Which lifecycle event is safe for manually disposing entity-specific Three.js resources without affecting shared assets?
- Does
remove()keep geometry and material references accessible for cleanup in the target A-Frame version? - Should disposal logic belong in a component
removehandler or a scene-level entity-removed observer?