Don't have time to run it right now, but I think it doesn't actually
leak them in the release player.  It will be a pain for running
endurance testing, but in general it should be ignorable.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of lytvynyuk
Sent: Saturday, March 22, 2008 4:55 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] FIY - WeakMethodClosure - memory leaking example.

 

Here i s little example which shows constant grows number of instance of
WeakMethodClousure... with this rate over night.... hm

<?xml version="1.0"?>
<!-- charts/BasicColumn.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
  <mx:Script><![CDATA[
     import mx.collections.ArrayCollection;
     [Bindable]
     public var expenses:ArrayCollection = new ArrayCollection([
        {Month:"High", Profit:2000},
        {Month:"Low", Profit:1000},
        {Month:"Med", Profit:1500}
     ]);
     
     private var timer1:Timer = new Timer(10! 00);
     
     
     private function timerGo() {
         timer1.addEventListener(TimerEvent.TIMER, generateData);
         timer1.start();
     }
     
     private function generateData(event:TimerEvent) {
         expenses.removeAll();
         expenses.addItem({Month:"XXX1", Profit:(Math.random()*10000)});
         expenses.addItem({Month:"XXX2", Profit:(Math.random()*10000)});
         expenses.addItem({Month:"XXX3", Profit:(Math.random()*10000)});
     }
     
 ! ; ]]></mx:Script>
  <mx:Panel title="Colum! n Chart" >
     <mx:ColumnChart id="myChart" dataProvider="{expenses}">
        <mx:horizontalAxis>
           <mx:CategoryAxis 
                dataProvider="{expenses}" 
                categoryField="Month"
           />
        </mx:horizontalAxis>
        <mx:series>
           <mx:ColumnSeries 
                xField="Month" 
           &nbs! p;    yField="Profit" 
                displayName="Profit"
                fills="[0xFF0000,0x00FF00,0x0000FF]"
           />
        </mx:series>
     </mx:ColumnChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
  <mx:Button label="Start Timer" click="timerGo();"/>
</mx:Application>

--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> If you try to remove a chart and the profiler shows it is still there,
> it is leaking.
> 
> If you reset its dataprovider several times and the number ! of
renderers
> and other objects it creates keeps increa! sing, th ere's a leak
there.
> 
> You just have to keep digging through with the profiler to find the
root
> cause. Sometimes, building simple test cases help too.
>

 

Reply via email to