-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Suggestion: Dispose of renderer context when canvas is destroyed? #132
Comments
i have found on your code: |
UltimateForm
changed the title
Suggestion: Dispose of renderer on when canvas is destroyed?
Suggestion: Dispose of renderer context when canvas is destroyed?
Jun 25, 2019
added your code to the unmount phase, i really thought that dispose is enough :-S |
@drcmda on a further note, i have also been noticing a memory leak, and it seems official: just letting you know |
thank you for the fix anyway, keep up the good work 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi again, you must be tired of me already, and I'll again annoy you on the subject of #96
I have noticed even if I only load a model at a time, I still get the warning, as you can check in this codesandbox link: https://codesandbox.io/s/react-three-fiber-context-loss-o33uq if you keep loading, unloading and reloading, you'll see that you'll end up getting the warning
WARNING: Too many active WebGL contexts. Oldest context will be lost.
this means the renderer is not being disposed when canvas is unmounted. Shouldn't it be? This is pretty much these stackoverflow qestions: https://stackoverflow.com/questions/21548247/clean-up-threejs-webgl-contexts and https://stackoverflow.com/questions/54323838/how-to-fully-clean-up-the-context-and-canvas-in-three-js. right now this is what i'm doing on my component:but i have to previously get the gl from useThree() on a FunctionComponent
i'll note that on this case its not as bad as what i was experiencing on the previous issue mentioned since the contexts and renderers being lost are no longer being in use, that said I don't think its optimal having garbage renderers and contexts around.
It'd be nice if the canvas object itself could either destroy and dispose it's renderer and context once its unmounted or reuse the renderer (which may be clunkier imo)
this might also be interesting: https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects
The text was updated successfully, but these errors were encountered: