Hey guys I hope I am just doing something wrong as we would REALLY like to use Away3d 4.0 in a big project that we are diving into. Here is the problem. I cannot get the memory to drop, no matter what I try when I load -> unload -> load a Away3D scene the memory always rises. Here is what I am doing.
I have a class that simply extends Sprite. When added to the stage it creates a View3D, Object3DContainer, 3 Color Materials, 2 Spheres and 1 Cube and 2 Listeners (Enterframe and Resize). Applies the Materials to those objects.
Added To Stage Code
_view = new View3D();
_view.antiAlias = 4;
this.addChild(_view);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(Event.RESIZE, onStageResize);
_ctr = new ObjectContainer3D();
_view.scene.addChild(_ctr);
var green:ColorMaterial = new ColorMaterial(0x00FF00);
var red:ColorMaterial = new ColorMaterial(0xFF0000);
var blue:ColorMaterial = new ColorMaterial(0x0000ff);
_ctr.addChild(new Sphere(green)).x = -200;
_ctr.addChild(new Sphere(red)).x = 200;
_ctr.addChild(new Cube(blue, 100, 100, 100, 11, 7, 25, false));
When removed from stage the class Removes all children, removes the 2 Listeners, calls dispose on the view, nulls the view, calls dispose on the ObjectContainer3D.
_camController.destroy();
_ctr.dispose(true);
while(this.numChildren >0) this.removeChildAt(0);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.removeEventListener(Event.RESIZE, onStageResize);
_view.dispose();
_view = null;
Finally I have a Shell application that has a simple timer. Every 30 seconds it unloads the AwayDemo waits 10 seconds then loads a new instance.
Even in such a small simple demo with 3 basic materials and objects the memory just increases over time. If i let this run overnight the next day the player is totally trashed and over a gig is used.
The project we are looking to get into involves long runs of the application, and moving back and forth between a screensaver and the application when users are interacting with it. Am I missing something simple to clean up the memory on this project?
thanks a lot!
-ross