Hi all,

I've been trying to track down a memory leak in our app and I believe I've
tracked it down to the DateField widget.
It appears that if I select a date programmatically and then delete the
component memory usage starts to creep up and
is seemingly never garbage collected. The sample code below when run on my
machine uses up a delta of ~50M
between when the app is first loaded and after 100 iterations of this
sequence. Additionally after 100 iterations the
Internet Explorer process is chewing up ~20% of my CPU while the app is
supposedly idling.

Has anyone else run into this issue and perhaps found a workaround? I gotta
feeling Matt is going to tell me to 
go wish :)

Cheers,
Paul.

<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; 
load="myLoad()"
>

<mx:Script>
<![CDATA[
var counter:Number;
var intervalId1:Number;
var intervalId2:Number;
var date:Date;


function destroy():Void {
clearInterval(intervalId2);


viewStack.destroyChildAt(0);
counter = counter + 1;
if (counter == 100) {
clearInterval(intervalId1);
}
}


function create():Void {
trace("date = " + date);
var dateField =
viewStack.createChild(mx.controls.DateField, undefined);

dateField.selectedDate = date;
intervalId2 = setInterval(this, "destroy",
2000);
}       

function myLoad():Void {
counter = 0;
date = new Date();
}

function startIterations():Void {
intervalId1 = setInterval(this, "create",
3000);  
}

function stopIterations():Void {
clearInterval(intervalId1);
}

]]>
</mx:Script>

<mx:VBox> 
<mx:ViewStack id="viewStack" />

<mx:Button label="start iterations"
click="startIterations()"/>
<mx:Button label="stop iterations"
click="stopIterations()"/>
<mx:Label text="{counter}" />
</mx:VBox>

</mx:Application>


~~-------
This e-mail may contain confidential information. If you are not the intended 
recipient, please notify the sender immediately and delete this e-mail from 
your system. You must not disclose this e-mail to anyone without express 
permission from the sender. The contents of all e-mails sent to and received 
from Optus may be scanned, stored, or disclosed to others at Optus discretion.

Optus has exercised care to avoid errors in the information contained in this 
e-mail but does not warrant that the information is error or omission free. The 
information (including any pricing information) contained in this e-mail is 
subject to change. This e-mail is not a quotation or proposal and no 
contractual obligations arise until you and Optus sign a formal written 
contract or formal variation to your existing contract. 

Any pricing contained in this e-mail is exclusive of GST unless otherwise 
stated.
********************************************************************



Reply via email to