Dispose of spherical harmonics arrays and packedArray in PackedSplats #239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #237 by expanding
PackedSplats.dispose()to also dispose the spherical harmonics textures stored inextraas well as setting all references to (large) arrays tonull. The latter is done since thePackedSplatandTextureinstances themselves are still retained in various places throughout, including dyno programs. Ideally these would be GC'ed but it's impractical hunting these down.There is a slight change in behaviour. Previously it was possible to call
splatMesh.dispose()and then use it again later. Generally in Three.js callingdisposeimplies the object won't be used any more and I think the same should hold for Spark for consistency. Only theinteractivityexample made use of this behaviour, but has been fixed.That said, it was a crude way to dispose of the textures (GPU resources) while still keeping a copy of the splat data in memory. Not sure if this was intended as a way to keep VRAM usage lower in the
interactivityexample, but if so, we should probably introduce a proper method for this purpose.