0 Replies Latest reply on Sep 12, 2012 7:22 AM by jozefchutka

    DataGrid.selectedIndex memory leak


      Hello again,

      I have noticed a memory leak in a DataGrid, in case I do not select an item, I am able to GC my dataGrid, if there was anything selected then dataGrid cause memory leak...

      here is the simpliest example:


      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                     minWidth="955" minHeight="600">
                  import mx.collections.ArrayCollection;
                  import mx.collections.ArrayList;
                  import spark.components.gridClasses.GridColumn;
                  private var columns:ArrayList = new ArrayList;
                  private var dataProvider:ArrayCollection = new ArrayCollection;
                  private function onCreationComplete():void
                      var column:GridColumn = new GridColumn;
                      column.dataField = "id";
                      container.selectedIndex = 0;
                  private function gotoOne():void
                      currentState = "one";
                  private function gotoTwo():void
                      columns = null;
                      currentState = "two";
              <s:State name="one"/>
              <s:State name="two"/>
          <s:Button click="gotoOne()" label="one"/>
          <s:Button click="gotoTwo()" label="two" left="150"/>
          <s:DataGrid id="container" top="30" includeIn="one" itemDestructionPolicy="auto"
                      creationComplete="onCreationComplete()" columns="{columns}"


      if you comment out line "container.selectedIndex = 0;" DataGrid gets GCed nicely.

      Any ideas how to GC DataGrid with selected item?

      I am using flex 4.6.0