Jump to content

Out of Memory Errors (Aw Snap)


DezOnlyOne
 Share

Recommended Posts

When swapping out meshes with large animations After a few swaps I get an OOM error. By swapping out animations I mean dispose of the previous mesh and load a new one. This was also an issue in THREE.js, but seems to be less of an issue because Babylon seems to handle files with large amounts of animations much better. However, it appears that both leave these animations in memory even after disposing of the mesh. What is the best way to dispose of a mesh with say, 20k frames of animation, and load another without getting an OOM. 

 

Thanks in advance for the help. 

Link to comment
Share on other sites

Might depend on the type of Animation, ANIMATIONTYPE_VECTOR3 or ANIMATIONTYPE_QUATERNION, for things like position / rotation / scale, or ANIMATIONTYPE_MATRIX for skeletal.

 

In the case of skeletal, the mesh does not "own" the animation, it is part of the BABYLON.Skeleton object.  BABYLON.Mesh.dispose() not explicitly dispose the skeleton (or anything on the CPU) , but it should not have to.  If all uses / references held of the BABYLON.Animation object were to fall out of scope, then it would be a candidate for garbage collection.

 

Remember:  This IS NOT C++ where you are responsive for releasing your own memory.  The VM handles that.  Mesh.dispose() is only explicitly releasing resources on the GPU.

 

If this is skeletal animation, scene.skeletons[ ] will need to splice out the reference 2 the object, so it can be garbage collected.

Link to comment
Share on other sites

I think there is something right in the question.

 

Looking at the code, it seems like animatables stay in an array in the scene and are never disposed. They should also be stopped before the mesh is destroyed, which I don't see as well.

I can push a fix (shouldn't be a problem), but I want to see if DK has a different approach.

Link to comment
Share on other sites

I put together a package. I can't get the cross origin proxy site to keep working over time. So I packaged everything up into a zip file. It is too big to attach to thisforum so here is the link. There are too buttons to load one of the 2 patients. alternating between them multiple times will produce the OOP error. 

 

http://protest.jht.com/duke/babylonswap.zip

Link to comment
Share on other sites

I am not totally sure how to read the memory snapshot, but it looks like the memory is tied up with Skeleton, bones, and animation. What I did was load the bigger patient, and then removed him. Disposing of skeletons and meshes. There is nothing visible on screen when I took this snapshot

 

Attached is a screenshot of the snapshot. I can upload the actual snapshot somewhere for you to download, but it is 59MB. 

 

post-16887-0-85256200-1446003964_thumb.j

Link to comment
Share on other sites

If I am reading this correctly, all or a lot of the space is in the Float32Arrays backing all the Matrixs objects.  The number of Matrix objects is pretty high, and is nearly identical to the number of Float32Arrays.

 

I wonder if they might still be in scene._activeSkeletons?  SmartArray.reset() called every frame does not actually make changes to SmartArray.data.  Could still be there.

Link to comment
Share on other sites

  • 2 weeks later...

I am still having the same issue. I have tried everything I know how to do. It seems that there is still this residual animation information that is left behind. I tried to delete all the skeletal animations, but nothing seems to work. I am not sure how many others have similar issues to mine who has tens of thousands of frames of animations that they need to have available, but it seems like I am crossing some threshold, or ding this completely wrong. I updated my babylonswap package for an example here

http://protest.jht.com/duke/babylonswap.zip 

 

I also uploaded it so that could be viewed online. 

 

http://protest.jht.com/duke/babylonswap/

 

When you load the page the app will load the patientA automatically. The problem is that in the application that I am building, I need to be able to swap files multiple times. As many times as my end user would like to. So when you click the button to load patientB, then back to A, then back to B and so on... You end up with an OOM error. This same thing was happening to me in threejs. Babylon works much better for my needs, but this one lingering issue, will make or break a HUGE project.

 

I just need to know what I am doing wrong here. 

 

please help

Link to comment
Share on other sites

I cannot do it myself with this model, I would need the help of one of our artists, but I could create a very simple animation to try with shapes. 

 

I setup 2 files with 10000 frames of animation, and around 80k verts. I can't do skeletal animations because I don't have the know how, and the artists have gone home for the evening. 

 

The files that I did setup seem to swap fine with just an animation of their position. They were very big as well(50MB & 170MB).

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...