Hello,

I've been troubleshooting a pretty major memory leak in our
application. I've narrowed it down to code which cleans up a chart's
series array and re-initializes it to add a new set of series with new
dataproviders, etc.

Note that with only the AddSeries, and SeriesDelete functions removed
(all other code including CategoryAxis create/delete, and all XML
manipulation remained) there was no leak.

I posted a "best practices" question about list cleanup and memory use
which describes the architecture I have:
http://groups.yahoo.com/group/flexcoders/message/29638?threaded=1

Below is the implementation of DeleteSeries which attempts to remove
every series in the chart and clean up the dataProvider in it. 

Can someone who knows the internal workings of the charts maybe look
at this and see if I'm missing something or if there are any known
issues with the cleanup of chart series?

thanks,
Thunder
__________________________________

public static function SeriesDelete( thisChart:ChartBase )
{
   // try to clean up the series by deleting them from the array using
splice
   var i:Number = thisChart.series.length;
   while(i--)
   {
       var obj:Array = thisChart.series.splice(i, 1);
       var oSeries:Series = null;
       if (obj[0] is Series)
       {
          oSeries = Series(obj[0]);
         if (oSeries.dataProvider is ListCollectionView)
         {
            var oView:ListCollectionView =
ListCollectionView(oSeries.dataProvider);
            oView.removeAll();
            if (oView.list != null)
               oView.list.removeAll();
            oView.release();
            delete oView.list;
            oView=null;
         }
         delete oSeries.dataProvider;
         oSeries.dataProvider=null;
         delete oSeries;
         oSeries=null;
      }
      obj=null;
   }
   thisChart.series = new Array();
}





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to