8 Replies Latest reply on Feb 17, 2011 11:52 AM by ShannaraAlaska

    Garbage Collection on DataGrid ItemRenderers




      It’s observed that custom ItemRenderer consumes lots of memory if the renderer is complicated and constitute of several display components, also if it’s embedded in a grid and the grid is refreshing frequently, it creates a new renderer instance for every row every time.

      So we are trying to do some additional cleanup work if a grid is removed from the display list and let the renderer garbage collected from memory. But to make the renderer to be candidate for garbage collection, we need remove all the references from the renderer firstly.



      We tried grid.removeAllchildren method, but no luck. From the flex profiler, I can see the grid is still referenced by the renderer as well as the components inside the renderer.(for example in my case below label1 and label2).


      Anybody have experience on this  kind of memory management  and performance tuning strategy? What’s the correct way to remove the reference of display object from others?



      Any help/thoughts will be highly appreciated.



      <mx:DataGrid id="grid" width="100%">


                          <mx:DataGridColumn headerText="column1" width="150"/>

                          <mx:DataGridColumn headerText="column2" width="200" itemRenderer="MyRenderer"/>





      public class MyRenderer extends UIComponent implements IListItemRenderer



                  Private var label1:Label;

                  Private var label2:Label;