Here, a test file... Why would this cause memory to build up?
package
{
import away3d.containers.View3D;
import away3d.materials.ColorMaterial;
import away3d.primitives.Sphere;
import flash.display.Sprite;
import flash.events.Event;
[SWF(width="1280", height="1024", backgroundColor="#000000",
frameRate="30")]
public class Test extends Sprite
{
public var view:View3D;
public function Test():void
{
view = new View3D();
this.addChild(view);
this.addEventListener(Event.ENTER_FRAME,
_handleEnterFrame);
}
private function _handleEnterFrame(e:Event):void
{
for (var i:Number = 0; i < 200; i++)
{
var x:Sphere = new Sphere(new
ColorMaterial(0x00ff00));
view.scene.addChild(x);
view.scene.removeChild(x);
}
}
}
}
On 16 jun, 18:07, Flyon <[email protected]> wrote:
> I'm having about 10 objects adding a child object to themselves about
> 30 times per second.
> These child objects remain for about 2 secconds, after which they are
> removed (including all their references).
>
> This makes that about 300 objects are created and removed per seccond,
> and there are about 600 active objects at any time.
>
> After commenting more and more code I found this:
>
> When the child objects that are created are empty classes that extend
> the ObjectContainer3D class, the memory is stable.
> When I add one line of code to this child class so that they add a
> sphere to themselves, the memory increases slowsy... but keeps
> increasing!!
> When I add a PathExtrude instead of the sphere with about 100 points
> in them, memory goes through the roof.
>
> I don't understand why it keeps increasing with this one line of code?
>
> addChild(new Sphere(new ColorMaterial(0x00ff00, 1), 10));
>
> After all, number of objects is stable, and memory stable without this
> line shows that the garbage collector does take care of all the
> removed objects right?
>
> I'm running this on the latest Broomstick from the svn.