Hi Everyone,

Let me start by saying that Away3D lite is amazing.  I recently
completed a project that required a fast / lightweight 3D engine, and
Away3D Lite did everything I needed and more.  I would highly
recommend it to anyone.

Now for my issue...  the project I was working on was a game that
required a lot of models (mostly Planes) to be added and removed from
the stage.  I noticed that the memory usage would creep up to a level
that it probably shouldn't be reaching.

I was removing all of my models as well as removing all of the
materials and disposing the related BitmapData objects, but it didn't
seem to make a difference.  Removing the scene also did not seem to
make much difference.  It just wouldn't release the memory.


My solution was to spend a Sunday afternoon going through the Away3D
Lite source code and try and patch up some leaks.  I changed all of
the Dictionary and Event Listeners to use weak references, and added a
destroy() method to every object I could find.  I also nulled of every
parameter of the objects, paying particular attention to the Vectors
that references other objects.

After a lot of messing around, I finally got it under control.  There
is still a mild leak in there, but it is about 2% of what it used to
be, and it may not even be Away3D that is causing it.

The only quirk i have found with these changes is that you have to be
sure to call remove the models from the scene, then call destroy on it
and it's materials, otherwise things go a  little kooky.

The version I am working with is Version 1, Revision 0.2.  I commented
every line of code I changed in case anyone else wants to check it out
or have a fiddle with it.

Hope it helps someone :)


http://groups.google.com/group/away3d-dev/web/sev%20away3dlite.rar

Reply via email to