ua4192 Posted June 19, 2017 Share Posted June 19, 2017 Dear all. Is it possible to fully free memory taken by browser when creating a new scene? I have tried everything like create a new engine, reseting scene and even dispose all meshes in the scene. My feeling is that firefox, Iexplorer, GoogleChrome are not aware about this memory release and they increment the memory already taken by the previous scene with the next one. This is very annoyance, finally the browser get all PC RAM memory. With ther bis scenes I am working with (1,5 GB RAM each scene) the behaviour is as expected not so good as expected. Best regards Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 19, 2017 Share Posted June 19, 2017 Theorically, if you call engine.dispose() everything should be removed Quote Link to comment Share on other sites More sharing options...
ua4192 Posted June 20, 2017 Author Share Posted June 20, 2017 Hi. I can guaranty you that at least in firefox this is not the case. When I load the scene, the memory taken by the previous loaded one (in the same firefox tab) is not released. The only way ir to kill the firefox process linked to this tab and load the page again. I am using engine.dispose() and it doesn't work. Try just to load a moderate GLTF or babylon file multiple time by reloading the page and you will see the same behaviour. Best regards Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 20, 2017 Share Posted June 20, 2017 I do not need to do this, but I modified the button of one of my scenes to do a engine.dispose() to see what happens. In Firefox, there is a memory snapshot thing. I snap before and after the dispose, and only small amount of the typed array / ArrayBuffer, and JS array data goes down. Before: After: ArrayBuffers & Arrays do not have a dispose, the GC is supposed to clean when they go out of scope. The only thing being actively disposed is GPU resources. Not sure you can actually request a GC like in Java (even then Java can just ignore you). I even actively re-assigned the Float32Array member, _data, of Buffer.ts in the dispose(). This build yielded the same results. When I load a different URL or even reload the same in the same tab, everything is cleaned up. You might be looking at system memory though. One thing I noticed is Firefox lets you go back to previous scenes. IT DOES NOT reload them. If you do a lot of refreshing during Firefox will log something like "max webgl sessions of 16 exceeded, last one dropped". It's a feature! Quote Link to comment Share on other sites More sharing options...
ua4192 Posted June 21, 2017 Author Share Posted June 21, 2017 Hi. In my case when I reload the page in the same tab or open another url the memory is not released. Maybe I have not watched you properly. Best regards Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 21, 2017 Share Posted June 21, 2017 How are you measuring memory? If you are using a tool external to FireFox like Windows Resource Monitor, then you should probably see memory move from free to standby as succeeding scenes load. That is so you may hit the back button. As I said before firefox does not reload scenes when you go back. Click this scene. There is an effect (1 of 3 randomly decided) run at the beginning, then animation. In the middle, go to any other page. Then hit the back button. In Firefox, it picks up right from where it left off. Other browsers reload & start over. To do this, it must keep the memory for the scene. You might not like it, but I see no problem, per say. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 21, 2017 Share Posted June 21, 2017 For doc purposes, I just got the Firefox 16 message: Quote Error: WebGL warning: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one. Quote Link to comment Share on other sites More sharing options...
max123 Posted June 22, 2017 Share Posted June 22, 2017 Same in Chrome: WARNING: Too many active WebGL contexts. Oldest context will be lost. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.