Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex 3 Memory leak issue
    primarykey
    data
    text
    <p>We have a huge flex applications using multiple modules. There is a huge memory leak problem over prolonged usage of loading and unloading modules.</p> <p>Based on all the search and different articles I understand that I need to clean up objects on unload, remove event listeners, stop timers and dispose any references.</p> <p>I started this by picking up one component at a time within one of the module.</p> <p>Here is how this is structured.</p> <p>There is one parent application which loads a module, which has multiple views. The component is defined in mxml and is referenced in the mxml module in a view stack.</p> <p>This mxml component is a VBox with event listeners added as-</p> <pre><code>&lt;mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" paddingTop="10" paddingLeft="10" paddingBottom="10" paddingRight="10" creationComplete="onInit()" show="onShow()" resize="onResize(event)" .... </code></pre> <p>There are couple of properties that are binded from the parent container in mxml. Other than the above listeners there is also a private variable accessed from outside -</p> <pre><code>[Bindable] private var _model:SModelLocator=SModelLocator.GetInstance(); </code></pre> <p>On unload of the module I call a dispose function in this component as below-</p> <pre><code>public function dispose():void { this.removeEventListener(FlexEvent.CREATION_COMPLETE,onInit); this.removeEventListener(FlexEvent.SHOW,onShow); this.removeEventListener(ResizeEvent.RESIZE,onResize); var arr:Array = this.getChildren(); for(var i:int = 0; i&lt;arr.length;i++) delete arr[i]; this.removeAllChildren(); _model = null; //Properties that are binded from the parent container Property1 = null; Property2 = null; this.deleteReferenceOnParentDocument(this.parentDocument as IFlexDisplayObject); } </code></pre> <p>Now when I run profiler and switch between modules number of instances of this component still continues to grow. I clicked on GC Collect on profiler and still the instances stay.</p> <p>On the parent container which is the module mxml, I also tried writing the following lines upon unload of module-</p> <pre><code>//function call to invoke dispose as above component1.dispose(); component1 = null; </code></pre> <p>Please help. I am not sure what am I missing here, or even if this is the right approach.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload