I agree with you, if there is a best practice, I will do it. I will
write a sample app and try with smaller chunks, I will share my test
results.
As for what I am doing, I am writing a monitoring app, always running
then testing then writing a report. I am hoping the app will be
running months without any restart.
ok, will be back soon with results...
Thanks for the time,
--- In [email protected] <flexcoders%40yahoogroups.com>, "Rick
Winscot" <[EMAIL PROTECTED]>
wrote:
I'll bite! You know. I'm a big proponent of "just because you can -
doesn't
mean you should." The case of loading a 20mb text (xml) file. I
think would
qualify. To be fair I did try a few experiments with the xslspec
(http://www.w3.org/TR/2001/REC-xsl-20011015/xslspec.xml) which is
nearly 25k
lines. I profiled a typical scenario of loading it as a string,
conversion
to xml and cleanup. The memory footprint was reasonable for the size
of text
- nothing to write home about. I did get some erratic results executing
repeated conversions (1 conversion per second for 10 seconds).
Still. things
settled down after about 120 seconds. Did I see anything that looked
like a
true leak? No. What I did see what the effect of a huge number of string
operations. and the memory footprint of a business case that made me
say -
"chunk it. or leave it." Flex is truly awesome, but I think that
what you
are trying to do has me wondering what the justification is (please
share).
Really - Flex will do what you ask it to do. it doesn't mean that it
will
perform well. but it will do it. This is true for any language - the
effect
is just more evident in ActionScript.
Rick Winscot
From: [email protected] <flexcoders%40yahoogroups.com> [mailto:
[email protected] <flexcoders%40yahoogroups.com>] On
Behalf Of Ilam Mougy
Sent: Saturday, March 29, 2008 12:49 AM
To: [email protected] <flexcoders%40yahoogroups.com>
Subject: [flexcoders] memory leak in converting string to xml
I am almost giving up on this issue, I don't know any work around.
Here is example, in AS:-
var strToBeXML:String = '<root>...</root>';// this is huge string,
20Meg xml for example.
myTrace('***** memory before xml conversion (A): ' +
System.totalMemory);
var xmlObj:XML = new XML(strToBeXML);
myTrace('***** memory after xml conversion (B): ' + System.totalMemory);
// now, there is no way to get rid of this increase in memory!
xmlObj = null;
myTrace('***** memory after xml deletion (C): ' + System.totalMemory);
protected function myTrace(str:String):void{
forceGC();
trace(str);
}
public function forceGC():void{
try {
new LocalConnection().connect('foo');
new LocalConnection().connect('foo');
} catch (e:*) {}
}
(C) is always similar to (B).
Any hits? I need to get rid of this xml object memory allocation and
I can't. I think I read all the articles about memory leaks. I
haven't used Flex 3 yet, but I am sure if I try and it says there is a
leak, so what, what should I do?
Thanks for your help.