UIComponent memory issue

Hi all,

I have observed **UIComponent **and found some interesting thing. Please check the following code which is present in **UIComponent **constructor.

addEventListener(Event.ADDED, addedHandler);
        addEventListener(Event.REMOVED, removedHandler);
        addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);

        // Register for focus and keyboard events.
        if (this is IFocusManagerComponent)
        {
            addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
            addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
            addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
            addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
        }

We all know that every component in Flex is extended by this core class. And we also know that a display object (ex:any Flex component) can not be marked for garbage collection until all of its event listeners were removed.

Now my question is where does the above event listeners removed, I don’t see anywhere… more over “addedHandler” is private function, so the listener can not be removed in descendants, it has to be removed in UIComponent.as only. I have also observed the same behavior in Spark List component too, where they are adding a listener in constructor itself, but not removing same anywhere else.

addEventListener(TouchInteractionEvent.TOUCH_INTERACTION_START, touchInteractionStartHandler);

Here again “touchInteractionStartHandler” is a private function.

So this means, every flex component is not garbage collected thus causing memory leak? Is that so?