Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We've learned that removing all references to an object makes that object eligible for garbage collection. However, even after an object becomes eligible for garbage collection, it continues to exist in memory until ActionScript decides to "sweep" it away during a garbage collection cycle. After the object becomes eligible for garbage collection, but before it is actually removed from system memory, the object continues to receive events and, in the case of Function objects, can still be triggered by setInterval( ).
For example, imagine a slideshow application that uses a class, ImageLoader, to load images from a server at regular intervals. The code for the ImageLoader class is as follows: