memory leak

Software: Away3D 4.x

sargon, Member
Posted: 22 November 2011 06:39 PM   Total Posts: 51

I have some objects like elevations, spheres etc on scene, then I am removing them all and dispose(true) them, but Flash buldier profiler tells me that there are still some Vector.<*> and Vector.<Number> instances in the memory in thousand of them of __AS__.vec and they take about of 70% of memory usage.

Can any one help with it ? do any one know how to delate them and deal with them ?

   

sargon, Member
Posted: 24 November 2011 10:23 AM   Total Posts: 51   [ # 1 ]

Does anybody know anything about that ? I am so confused becouse memory rise so high in my project and I dont know what to do ... :(

   

sargon, Member
Posted: 25 November 2011 01:10 PM   Total Posts: 51   [ # 2 ]

I realized that after deleting for example elevation in project, from scene etc. There is still reference to it in view… it is posible ? and why it is there, and how can I delete it .

best regards.

   

inSertCodE, Sr. Member
Posted: 25 November 2011 04:19 PM   Total Posts: 105   [ # 3 ]

You have to empty the holding variables too or assign them new values(objects).
For example if you have a texture assigned to variable _texture its not enough just to stop using it or remove it from the scene. You have to empty the holding variable…

_texture = null;

After some time (probably few seconds) flash will dispose of it.

   

sargon, Member
Posted: 25 November 2011 05:48 PM   Total Posts: 51   [ # 4 ]

smile thanks I know that.. And I am doing it but thanks for reply !

feg.

ter = new Elevation(...);
scene.addChild(ter);

...

scene.removeChild(ter);
ter.dispose(true);
ter.disposeAsset();
ter null;

try 
{
     
new LocalConnection().connect('foo');
     new 
LocalConnection().connect('foo');
    
catch (e:*) {} 

and again nad again ... but FB profiler shows me that there are still reference to elevation…
feg:

make Elevation - > 1 ref to Elevation
delete Elevation - > 1 ref to Elevation
make Elevation -> 2 ref
del Elevation -> 1 ref
make Elevartion -> 2 ref
...

I dont have any idea where this ref to Elevation is… maybe somewhere in Away engine ?

   

inSertCodE, Sr. Member
Posted: 26 November 2011 11:16 AM   Total Posts: 105   [ # 5 ]

Even if you empty the variable the reference to elevation remains as you declared the variable as elevation (var ter:Elevation;)
However if its empty it holds up very little memory, only the reference, which should be few bytes.

If you want to completely remove the variable and not use it again later try:
delete ter; //(I see you already did)

However this will not delete the variable reference instantly. Flash has its own way of disposing which you can’t control and there is no way of telling when the reference will be removed.

In summary, try and trace(ter);  If its null there should be only minimum memory usage. Its not a good practice to delete variables that can be used again in future, just empty them and reuse them in future.

Try and test this. Make a very complex elevation that should take up some noticeable memory. Put some action listener that will delete and empty the elevation and see if the memory usage drops after some time…

   

sargon, Member
Posted: 26 November 2011 03:41 PM   Total Posts: 51   [ # 6 ]

You are right,
Elevation object takes about 100K so it is nothing, but geometry that it generates takes 10mb so it quite large amount, it is stored by __AS__.vec package in Vector.<Number>...
And the problem is that I sugest that if there is still Eleveation ref the geometry exist too.

And I want to delete it, becouse even if I will need it I want to make new one and not holding it in memory in case of using it again.

What do you mean by delete obj ? As I know you can delete only dynamic property and not obj right?

   

inSertCodE, Sr. Member
Posted: 26 November 2011 05:48 PM   Total Posts: 105   [ # 7 ]
sargon - 26 November 2011 03:41 PM

What do you mean by delete obj ? As I know you can delete only dynamic property and not obj right?

Yes you are right, my bad…

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 08 July 2012 07:18 PM   Total Posts: 166   [ # 8 ]

Hi, sargon.
I run into the same problem now.
I deleted my model data same as what your did.
In FlashBuilder profiler, “Vector.<Number>” increase more and more.
That takes over 80% of all memory usage.

If you have already find out any solution, please share that with me.
Thanks.

   

dubletar, Member
Posted: 30 August 2012 03:56 AM   Total Posts: 73   [ # 9 ]

I have now run into this issue.

I have disposed of every reference, all event listeners, etc to an elevation() and the memory keeps growing.

Has there been a solution to this?

Anyone?

Im using Away3D Gold

   

sargon, Member
Posted: 30 August 2012 05:23 PM   Total Posts: 51   [ # 10 ]

I dont know how it is in Gold version I had some problems with it but you must remeber to make as less geometries as you can. ( you should share geometries as it is possible )
If you have two objects that has the same geometry then they can share it:

(it also works for material)

geometry = new SphereGeometry(...)
material = new ColorMaterial(...)
m1 = new Mesh(geometry,material)
m2 = new Mesh(geometry,material)

instead of

m1 
= new Mesh(new SphereGeometry(...),new ColorMaterial(...))
m2 = new Mesh(new SphereGeometry(...),new ColorMaterial(...)) 

you should also dispose geometries,materials by your self, becouse Away3d dispose method removes only obj from its parent children list.

if it is posible Reuse materials,geometries instead of making new ones.
Make a pool that will hold all resources that you will use.

Making new objects also makes some memory handling problem, if possible reuse them.

Thats all I can say.
its very easy to make memory leak so youshould be very careful in handling objects etc.

[edit]
Use falsh Builder profiler to see what kind of data makes memory leaks

   

dubletar, Member
Posted: 02 September 2012 12:46 PM   Total Posts: 73   [ # 11 ]

Ok, Thanks for responding.

Now I’m putting everything in arrays so that the flash app removes everything (objectContainer, 3d Mesh, BitmapData)... but how would I remove geometry?

And what is the most efficient way to clear out a Loader and Loader3D? (My loaders are loading images.)

   

sargon, Member
Posted: 02 September 2012 07:33 PM   Total Posts: 51   [ # 12 ]

Im not sure that putting evrything to the array is a good option, you shuld make also some Object Factories that handle deleting/making new objects.

With the geometry it is tricky to remove it, becouse,
You must be sure that there aren’t any references to this geomety.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X