AS3 Memory management when instantiating extended classes

Posted by araid on Stack Overflow See other posts from Stack Overflow or by araid
Published on 2010-05-16T19:33:12Z Indexed on 2010/05/16 19:40 UTC
Read the original article Hit count: 287

I'm developing an AS3 application which has some memory leaks I can't find, so I'd like to ask some newbie questions about memory management.

Imagine I have a class named BaseClass, and some classes that extend this one, such as ClassA, ClassB, etc.

I declare a variable:

myBaseClass:BaseClass = new ClassA();

After a while, I use it to instantiate a new object:

myBaseClass = new ClassB(); 

some time after

myBaseClass = new ClassC(); 

and the same thing keeps happening every x millis, triggered by a timer.

Is there any memory problem here? Are the unused instances correctly deleted by the garbage collector?

Thanks!

© Stack Overflow or respective owner

Related posts about as3

Related posts about memory-management