ObjectContainer3D.dispose() blows up on me!

Software: Away3D 4.x

Avatar
Bob Klein, Newbie
Posted: 23 November 2011 10:12 PM   Total Posts: 17

My application creates many different scenes that are in use for a while and then are disposed of to never be used again.  Whenever I clean up a scene I
do the following:

1. set view.scene = new Scene3D()
2. call view.render()
3. call dispose(true) on the old scene’s ObjectContainer3Ds
4. set the old scene to null

Whenever I do this I get the following runtime error in dispose(true)

RangeError: Error #1125: The index -1 is out of range 118.
at away3d.materials::MaterialLibrary/unregisterMaterial()
at away3d.materials::MaterialBase/dispose()
at away3d.entities::Mesh/dispose()
at away3d.containers::ObjectContainer3D/dispose()
at lib.play::tour/f_exit()

Any ideas of what I am doing wrong or is this a bug?

thanks,
...bob…

   

canado, Newbie
Posted: 28 November 2011 12:48 PM   Total Posts: 11   [ # 1 ]

I have exactly the same problem.
Did you find a solution or a workaround?

   

louis87, Jr. Member
Posted: 28 November 2011 01:38 PM   Total Posts: 46   [ # 2 ]

you can put a try-catch

   

canado, Newbie
Posted: 28 November 2011 02:39 PM   Total Posts: 11   [ # 3 ]

if I do that, I ll have a memory leak since the dispose is not working

   

Avatar
Bob Klein, Newbie
Posted: 28 November 2011 04:39 PM   Total Posts: 17   [ # 4 ]

No, I haven’t found a workaround yet.  I was hoping that some wisdom would appear here on the blog to show me the error of my ways.  But as you see, nothing so far…

I’m gonna’ start fiddling with the api source code to see if I can figure out what is going on here.  I’ll let you all know if I figure it out.  This is a show stopper for me because if I do not do the dispose and don’t actually reclaim the memory the code stops working after a couple of iterations of creating and destroying scenes and then my application has to be restarted.

If there is no suitable way to clean up a scene and be able to use the memory resources my app is dead on arrival.  I’ll have to crawl back over to the alternativa web site and start learning to read the Russian comments mad

Any wisdom out there from those more experienced with the internals of the api?

thanks,
...bob…

   

canado, Newbie
Posted: 28 November 2011 04:50 PM   Total Posts: 11   [ # 5 ]

I search a bit on this forum and I found that there are another branch

https://github.com/away3d/away3d-core-fp11/branches

and the one called texturerefactor, seems to work, but you ll need to clean the texture by yourself.

I can’t test it right now though, maybe tonight. In the meantime you can try it and tell me if this branch is working for you.

   

Avatar
Bob Klein, Newbie
Posted: 29 November 2011 12:46 AM   Total Posts: 17   [ # 6 ]

I tried the latest Git branch and yes this problem is now gone!  The call to dispose() does not crash.  However there is still a large memory leak in that every time I run through a sequence of creating a scene, viewing it, and then attempting to clean up all of the data used by calling dispose on the View, all Object3DContainers and all TextureMaterials (and BitmapTextures) I get large increases in memory used with each iteration.  [Of course I set all pointers of these items to null after calling dispose()]

In summary I’m still looking for the proper way to clean up all of the resources used in the creation of a scene so that a new scene can be created in its place without eventually crashing the application because of a large memory leak.

Any ideas out there?

thanks,
...bob…

   

canado, Newbie
Posted: 29 November 2011 12:55 AM   Total Posts: 11   [ # 7 ]

This branch I think is supposed to clean the geometry only, you have to manually clean the texture, and the listeners if you have any (preferably in weak mode)

   

Avatar
Bob Klein, Newbie
Posted: 29 November 2011 01:12 AM   Total Posts: 17   [ # 8 ]

Well what does it mean to “manually clean the textures”?

All my textures are created as

new TextureMaterial(new BitmapTexture(bmd)) where bmd is BitmapData

Currently I call dispose() on the TextureMaterial object and also call dispose() on it’s texture property (which is the BitmapTexture) and then I null everything out.

Doing this yields no runtime errors but I still have a large memory leak…

Obviously I am missing something…  Any ideas?

It would be nice if there was a reset() function that wiped out all of the away3d memory resources so that one could start fresh with a new scene.

thanks in advance,
...bob…

   

louis87, Jr. Member
Posted: 29 November 2011 07:32 AM   Total Posts: 46   [ # 9 ]

I agree with Bob Klein, I’m doing the imposible to clean all the current view but it doesn’t work. It has an impact in memory (obviously) and in the next loads time…

So a function that clean all memory using by away will be amazing, or an example in Github on how to do it.

thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X