-
-
Notifications
You must be signed in to change notification settings - Fork 1
bug(knowledge-graph): Three.js GPU resources not disposed on KnowledgeGraph3D unmount #3399
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
When the user toggles 2D→3D→2D repeatedly, the KnowledgeGraph3D component does not dispose Three.js GPU-allocated resources (geometry, materials, textures, renderer) when it unmounts. Each toggle cycle leaks WebGL memory until the browser tab runs out of GPU memory or crashes.
Root Cause
The original onUnmounted hook only called graph.pauseAnimation() but did not traverse the scene tree to dispose objects. Three.js requires explicit disposal:
graph.scene()?.traverse((obj) => {
obj.geometry?.dispose()
for (const mat of [obj.material].flat().filter(Boolean)) {
for (const v of Object.values(mat)) {
if (v?.isTexture) v.dispose()
}
mat.dispose()
}
})
graph.renderer()?.dispose()Impact
- GPU memory grows unboundedly on each 2D↔3D toggle
- Observed on any browser with WebGL support
- Eventual tab crash in long-running sessions
Fix
Implemented full scene traversal disposal pattern in KnowledgeGraph3D.vue onUnmounted.
Already fixed in: PR #3372 (fix: code-review issues for 3D view toggle)
References
- PR feat(knowledge-graph): add 3D force-graph view toggle (#3330) #3359 (original implementation)
- PR fix(knowledge-graph): code-review fixes for 3D view toggle (#3330) #3372 (fix)
- Issue feat(knowledge-graph): add 3D force-graph view toggle to KnowledgeGraph.vue #3330 (parent feature)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working