Hi all,
I'm filling a datagrid with entries from an XML file using the following
code. Although the code uses a lot of CPU and sometimes it causes Flash
player to prompt for aborting the script (I reply no and it works fine
after that), my problem is memory usage.
Although my XML file is at most 5MB, Flash player (7) uses up to 150MB
of RAM. Plus, closing the player doesn't immediately release memory, but
it rather appears in Task Manager for quite a while, slowly decreasing
memory usage.
I'd like to ask if that's a problem of Flash handling big XML files, or
if it's a problem with my code (creating recursive loops or anything
like that).
Can anyone check the following code and possible provide an alternative
way for the same task?
Thanks a lot in advance
=====================================================================
lib_xml = new XML();
lib_xml.ignoreWhite = true;
lib_xml.onLoad = function(success){
if(success){
list_root = library_xml.firstChild.firstChild.childNodes[11];
num_list_nodes = list_root.childNodes.length;
num_t = 0;
for(i=0; i<num_list_nodes; i++){
if (list_root.childNodes[i].nodeName == "dict"){
num_t ++;
t1=list_root.childNodes[i].childNodes[3].firstChild.nodeValue;
t2=list_root.childNodes[i].childNodes[5].firstChild.nodeValue;
playlist_grid.addItem({COL1:t1,COL2:t2});
}
}
total_t.text = num_t;
} else {
trace("Error loading XML");
}
}