actionscript 3 - AS3 Memory management when instantiating extended classes -


I am developing an AS3 application that has some memory leaks that I can not find, so I want to ask something. I'm newbie questions about memory management.

Imagine that I have a class of base class name, and some classes that increase it, such as classes, classesby, etc.

I declare a variable:

  myBaseClass: base class = new square (); After a while, I use it to instantiate a new object:  
  myBaseClass = new ClassB ();  

After some time

  myBaseClass = new category ();  

And the only thing gets us every x, which is triggered by the timer.

Is there a memory problem here? Are the unused examples removed correctly by the garbage collector?

Thank you!

Assume that you have not the example (or, possibly, its content) There are other references, garbage collectors will clean them. However, the time before cleaning, as far as I know, is erratic (there may be some difficult time in use, but I have never seen it in the document). If you are making a large number of examples, you can use a lot of memory before you become clear before.

An AS call (the name of this name saves me at the moment) to force GC to run, but it should not normally be necessary. If you find it necessary, then almost all you need to think about how your application works.


Comments