-
Notifications
You must be signed in to change notification settings - Fork 155
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
Free memory when a-scene is unmounted #110
Comments
@ebhoren probably way too late, but I was having a similar issue to you. I am rendering 2 scenes, each displayed in a React Tab. I was able to switch between the scenes in the tabs without any apparent visual issue, but noticed that each time I switched to display/re-display the scene, a new WebGL context was created. On the version of Chrome I'm using, after 16 contexts are created, Chrome warns you in the console that it's going to start dropping the oldest context when a new one is created. I also noticed that leaving the scene open in a tab for a long time eventually caused the browser to become slugglish. The following code appears to clear these issues:
and added it as an attribute to the Scene thus: While it doesn't tie into React's lifecycle events, as the Scene component is removed from the DOM, it triggers the A-Frame component's remove function and the clean-up happens there. (Caveated by the fact that I'm not an expert with WebGL, Three or A-Frame) |
@glidepro Yes, it's a bit too late but i really appreciate your solution. |
I’m using AFRAME with react-aframe and i need to unmount scene at a certain time. Is there a way to free memory used by AFRAME after the scene as been unmounted?
Thanks
The text was updated successfully, but these errors were encountered: