PDA

View Full Version : does the memory clear up when ... ?


galtzur
08-20-2008, 03:24 PM
Hello to all.

my question is as follows:
when does the flash clears the memory of objects that are not being used.

for example:
lets say I've created a class called 'Thumb'.
now when I want to add it I do the following:
var _thumb:Thumb;

_thumb = new Thumb();
addChild(_thumb);
now let's say I want to remove:
removeChild(_thumb)
question: the way I understood it is that the data is still available which means that it still uses memory.
is it correct ?

now lets say that I create a new thumbs and use the same variable to hold it , like so:
_thumb = new Thumb();
addChild(_thumb);

question: what happened to the previous Thumb. was it removed for the memory ? if not how can I access it ?

also
I've tried using delete in order to clear memory of object I no longer need, but that didn't work (got an error of some sort).
question: how do I clear memory of object I no longer need

I hope that my question are not due to incorrect programing practice and that you can help me.

thank you all
:)

Nandha
09-10-2008, 12:27 PM
;)hi galtzur,

* the object resides in memory untill the reference to the object exists...

*when u create a new object with same var and Class name it just overrides the previous....

*you can clear it by assigning the object to null...._thumb=null