Jump to content

scene cleaning problem


ua4192
 Share

Recommended Posts

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

Link to comment
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

Link to comment
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!

Link to comment
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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...