This content has been marked as final. Show 3 replies
Remember to use removeEventListener before deleting objects, for each event listener added to object, otherwise a reference will still remain in memory after deleting the object.
ok but is there a function to check if a object has references?
or a simple function to delete all references and the object?
I don't think so. See FB 2.0.1 help topic "Object creation and destruction" or LiveDocs:
Destroying unused objects
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.
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() method
You cannot call the removeEventListener() method on an event handler that you added inline in MXML.
The weakRef parameter to the addEventListener() method provides you with some control over memory resources for listeners. A strong reference (when weakRef is false) prevents the listener from being garbage collected. A weak reference (when weakRef is true) does not. The default is false.