-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory leak when meshes update #263
Comments
it's missing a key. react won't unmount (and therefore dispose) it because it thinks you're just updating props. elements.map(element =>
<mesh key={element.uuid} material={element.material}>
<geometry />
) |
thanks for your reply and kind remind me, I forget this in my example.
this problem is not solved. |
could you put this down into a codesandbox? a very reduced example that i can test PS. this is an automatic mem-leak as well: args={[new THREE.Shape(PointsToVector3Array(polygon.points))]} means it's recreating buffer geom on every render. const points = useMemo(() => new THREE.Shape(PointsToVector3Array(polygon.points)), [])
...
args={[points]} |
thanks you very much, I realize the meaning of yours. but the problem still exists when I try this. so I guess the problem root is the dev-tool.so I replace react-three-fiber to three in my project, everything is ok. |
👋 hi
I want to use
react-three-fiber
to draw something like this:elements.map(element =>
<mesh material={elementMaterial}>
<shapeBufferGeometry>
</mesh>
)
when count of elements update, there will generate all new element again and can't dispose old geometry, I try to use
useEffect
to solve this problem but not work like this:const map = () => { useEffect(() => { return function ref.current.geometry.dispose() }, []); }
The text was updated successfully, but these errors were encountered: