Lacking a comprehensive memory (leakage) management guide

Software: Away3D 4.x

Jake, Newbie
Posted: 16 September 2012 07:18 PM   Total Posts: 11

I’m an Away3D rookie, but have worked on a couple of 4.7 projects. I haven’t found much solid information on identifying the source of memory leaks and dealing with them. I have searched but the information seems sketchy and scattered in forum posts. Didn’t see much scanning the 2 Away3D 3.6 books other than this practice in example code:
removeChild(thing);
thing = null;

Also say some old forum discussions on an old (fixed?) Adobe bug that caused a leak. If I could at least identify who is to blame for a leak.

Just spend a couple of hours trying to setup testes to isolate the annoying memory leak in a project in which I was employing mesh clones in an effort to minimize memory use.

I tried to isolate things, simplifying conditions by only storing a reference to a newly created clone in variable or array, without attaching it to any entity.

Tried loading up an array with 1000 clones to get more measurable ram numbers, then setting these references to null, nulling them consistently had no effect on ram.

the simplest test, repeating:
X = someMesh(clone();

Ram goes up each time, I would think that would be the same as nulling the reference to the previous copy.

I repeated this basic test in a simplest environment by adding a few lines of code to the Away3D demo Basic_View.as each clone of the single mesh with a bitmap texture seems to increase ram usage by 33.9 k.

My test setups with 1000 iterations cause a 30-50mb ram increase, would one expect that amount to be automatically cleaned up, tested 10,000 iterations getting a 500mb increase that seemed to stick as well.

I used AwayStats or System.totalMemory to measure ram usage.

tried the gskinner force GC kluge (dating back to Aug 2006):
try {
  new LocalConnection().connect(‘foo’);
  new LocalConnection().connect(‘foo’);
} catch (e:*)

With no effect on the measured results.


(An aside, didn’t get to verify it, but it seems that setting the visible of an object off and on causes the AwayStats panel poly count to increment)


*** Update ***

After further experimentation I reduced the ‘leak’ from my Mesh cloning experiment using Away3D demo Basic_View.as as a testbed, reduced the ram increase from 4.5 k per mesh to about 0.35k by first nulling the geometry and the texture of the mesh before nulling the actual mesh clone reference. (these last results averaged over 30,000 clone references stored in an array) you can definitely see the results of the forced garbage collector, that remaining memory increase may be negligible, it varied and was actually was below starting memory in some test runs.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X