1 Reply Latest reply on Oct 15, 2009 5:20 AM by Cr99

    Garbage collecting AxisRenderers

    Cr99 Level 1

      I have an AIR app that needs to run 24/7.   It's currently on about day 5 and hasn't crashed, but I'm watching the Activity Monitor memory creap slowly up and so I know that it eventually will crash.  I've been running the profiler and it seems like the problem is with AxisRenderer:

       

      Picture 1.png

       

      The instances and memory just keep going up and up and up for ARLabelData.  It's a small leak, but over many days, it adds up.  Since this is a Flex/AIR class I'm not sure how to keep this from happening.  Here's what I've tried so far:

       

      I removed all uncessary event listeners (I didn't have a whole lot to begin with, but I was told this was the number one cause of memory leaks so I did this and it seemed to have no affect).

       

      Then I tried:

       

      flash.system.System.gc();

      flash.system.System.gc();

       

      I saw a post somewhere that by calling this twice, you force garbage collection.  This seemed to have cleared up some of the problems since the app used to crash once a day and now it's running longer, but it doesn't seem to take care of the AxisRenderer leak.

       

      I've tried using an object pool.  My app creates charts, in fact 2 new charts every minute currently (though it is designed to do more if the need arises).  It's all done in Actionscript.  Basically, it runs and listens for data to be pushed to it from the server, draws the charts and then sends them back to the server to be saved as images. So I created a pool of LineSeries objects, PlotSeries objects, etc to use over and over again.  However when I tried doing this with a pool of AxisRenderer objects, the app crashed after the second set of charts was sent because it kept coming up with a null pointer to it's parent chart.  So the most obvious solution to the problem, i.e. a pool of AxisRenderer objects seems like it's not possible.

       

      Does any one have any ideas about how to fix this memory leak?