Skip to content

fix memory leak issue#292

Open
WilliamLiu-1997 wants to merge 2 commits intosparkjsdev:v2.0.0-previewfrom
WilliamLiu-1997:memoryLeakFix
Open

fix memory leak issue#292
WilliamLiu-1997 wants to merge 2 commits intosparkjsdev:v2.0.0-previewfrom
WilliamLiu-1997:memoryLeakFix

Conversation

@WilliamLiu-1997
Copy link
Copy Markdown

Memory Leak Fix

Incomplete or missing dispose() methods cause GPU resources and large typed arrays to leak when SplatMesh instances are destroyed.

Changes

  • SplatMesh.dispose() — Release cached DynoPrograms, SplatEdits, SplatSkinning, RgbaArray, LoD state, context refs, modifiers, and callbacks. Also clean up caches on generator rebuild.
  • SparkRenderer.dispose() — Cancel pending timers, clear LoD tracking structures, dispose material/geometry. Add unregisterMesh() to clean up LoD entries from all active renderers.
  • ExtSplats.dispose() — Dispose SH textures (sh1sh3), clear extArrays and extra.
  • PackedSplats.dispose() — Dispose SH textures, null out packedArray, clear extra.
  • SplatAccumulator / PackedSplats — Add releaseGeneratorProgram() to evict and dispose cached DynoProgram from static maps.
  • DynoProgram — Add dispose() to release associated ShaderMaterial.
  • SplatEdits — Add dispose() to release SDF DataArrayTexture.
  • SplatSkinning — Add dispose() to release skin/bone DataTextures.

@WilliamLiu-1997
Copy link
Copy Markdown
Author

Here are examples:

Example that fixed memory leak
https://threejs-3d-tiles-renderer-mynn6oxso-williamliu1997s-projects.vercel.app/

Example that show memory leak (you can see the memory usage in red memory panel, in this example, as you look around, zoom in/out, the memory usage will keep inscreasing)
https://threejs-3d-tiles-renderer-dq57u8e0s-williamliu1997s-projects.vercel.app/

Memory Leak Example

Image ### Memory Leak Fixed Example Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant