Monday, December 9, 2013

Memory Management via Garbage Collection [Actionscript 3]

In actionscript you can force garbage collection (GC) to run, but it's a bad idea if you do so.
System.gc();
But we can't predict at what time it'll run even if you force it to run.
GC runs once a while and you can make objects eligible to dispose by using several methods.
  • Unregister all listeners
  • Stop all timers and intervals
  • Stop playheads like sounds,videos.
  • Deactivate objects that would become unreachable if the object itself became unreachable. (nullify)
Scenario behind as3 garbage collection is more much similar to java gc.