Skip to content
Discussion options

You must be logged in to vote

@FrostKiwi short answer: no, neither R3F nor drei automatically deep-disposes GLTF GPU resources on unmount. you have to do it yourself. here's why and the correct pattern.

why dispose={null} exists in gltfjsx output: useGLTF caches loaded data via suspend-react. if R3F auto-disposed meshes on unmount, remounting the same component would find corrupted GPU resources in the cache. so gltfjsx disables disposal to protect the cache.

why useGLTF.clear(url) isn't enough: it only removes the JS-side cache entry from suspend-react. it does NOT call .dispose() on any three.js objects. your geometries, textures, and materials stay in VRAM. (drei#1590 confirms this)

why R3F's auto-disposal misses t…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@FrostKiwi
Comment options

@sunnypatell
Comment options

Answer selected by FrostKiwi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants