Garbage colleciton of Flex : with Example

Flash Player provides built-in garbage collection that frees up memory by destroying
objects that are no longer used. To ensure that the garbage collector destroys your
unused objects, remove all references to that object, including the parent’s reference
to the child.

On containers, you can call the removeChild() or removeChildAt() method to remove
references to child controls that are no longer needed. The following example removes
references to button instances from the myVBox control:


private function destroyButtons(e:Event):void {

You can clear references to unused variables by setting them to null in your ActionScript; for example:

myDataProvider = null

To ensure that destroyed objects are garbage collected, you must also remove event
listeners on them by using the removeEventListener() met


3 Responses to Garbage colleciton of Flex : with Example

  1. Neelam Sanjeev says:


  2. Neelam Sanjeev says:

    I want to know how to garbage collect strings

  3. gyani says:

    yes yes neelam, i also want to know how objects r garbage collected. plz help me….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: