Sign in to follow this  
Followers 0
ua4192

scene cleaning problem

8 posts in this topic

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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:

before.jpg.ffa8ee30d5c12a53eb547e8b66a7e9a6.jpg

After:

after.jpg.0a2c41d785209b7d2089fd6772e99bf7.jpg

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.