5 Replies Latest reply on Jan 14, 2011 10:33 AM by andres margalef

    Flex4 TextInput module unload memory leak

    andres margalef

      Hi, i have an application (Application.mxml) that loads a simple module (Charts.mxml) using module loader. The module has a component spark.components.TextInput.
      When i unload the module, using the profiler in flash builder the module stay alive and not get garbage collected. Any answer for this?

       

      Application.mxml:

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <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">

       

      <fx:Script>

      <![CDATA[

      import mx.events.FlexEvent;

       

      public function load():void {

      appLoader.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

      appLoader.loadModule("com/scanntech/Charts.swf");

      }

      public function unload():void {

      btnUnload.setFocus();

      appLoader.applicationDomain = null;

      appLoader.unloadModule();

      }

      ]]>

       

      </fx:Script>

       

       

      <s:layout>

      <s:VerticalLayout/>

      </s:layout>

       

      <s:Button id="btnLoad" label="load" click="load()"/>

      <s:Button id="btnUnload" label="unload" click="unload()"/>

      <mx:ModuleLoader id="appLoader" width="100%" height="100%" />

      </s:Application>

       

       

      Charts.mxml:

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Module

      xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="library://ns.adobe.com/flex/spark"

      xmlns:mx="library://ns.adobe.com/flex/mx">

       

      <!-- No Leak -->

      <!--<s:CheckBox />-->

      <!--<s:TextArea />-->

       

      <!-- Leak -->

      <s:TextInput />

      </mx:Module>

       

       

      PD: sorry my bad english