title: Component doesn't get garbage collected
body: <p>I just noticed a strange behaviour while looking at my application in the Flash Profiler. When I click a button in my TitleWindow then the TitleWindow doesn't get garbage collected after it is removed. I have no idea why that is happening.</p>
  
  <p>I've created a small example application, so you can try it out yourself:</p>
  
  <p><strong>Main.mxml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
                 xmlns:mx="library://ns.adobe.com/flex/mx" pageTitle="Memory Leak (Spark)"&gt;
  
      &lt;fx:Script&gt;
          &lt;![CDATA[
              protected function openWindowBtn_clickHandler():void
              {
                  removeAllElements();
                  addElement(new ExampleView());
              }
          ]]&gt;
      &lt;/fx:Script&gt;
  
      &lt;s:controlBarContent&gt;
          &lt;s:Button label="Open Window" id="openWindowBtn" click="openWindowBtn_clickHandler()"/&gt;
      &lt;/s:controlBarContent&gt;
  &lt;/s:Application&gt;
  </code></pre>
  
  <p><strong>ExampleView.mxml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
                 xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" title="Example View" close="closeHandler()"&gt;
  
      &lt;fx:Script&gt;
          &lt;![CDATA[
              import mx.core.IVisualElementContainer;
  
              protected function closeHandler():void
              {
                  var visualElementParent:IVisualElementContainer = parent as IVisualElementContainer;
  
                  if (visualElementParent)
                      visualElementParent.removeElement(this);
                  else
                      parent.removeChild(this);
              }
          ]]&gt;
      &lt;/fx:Script&gt;
  
      &lt;s:layout&gt;
          &lt;s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/&gt;
      &lt;/s:layout&gt;
  
      &lt;s:Button id="doSomethingBtn" label="Click me!"/&gt;
  &lt;/s:TitleWindow&gt;
  </code></pre>
  
  <p>When you click "Open Window" and close the ExampleView without clicking the "Click me!" button in it then the GC kicks in and removes the ExampleView. However, when you click on "Click me!" and close the ExampleView afterwards, the ExampleView stays in memory forever.</p>
  
  <p>I wasn't able to find the references in the Profiler which cause this behaviour. I hope someone knows a solution to this, otherwise Flex is creating a lot of memory leaks.</p>