Professional Web Applications Themes

Flash and XML; using a lot of memory - Macromedia Flash Data Integration

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 ...

  1. #1

    Default Flash and XML; using a lot of memory

    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");
    }
    }
    lib_xml.load("Library.xml");
    Ken Guest

  2. #2

    Default Re: Flash and XML; using a lot of memory

    your code seems ok to me, but 5 MB of xml is simply too much for flash
    player.
    i split files up to a maximum of about 60kB. thatīs a data load th player
    can handle easily.

    "Ken" <kenb-online.gr> schrieb im Newsbeitrag
    news:d7o9ld$d8m$1forums.macromedia.com...
    > 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");
    > }
    > }
    > lib_xml.load("Library.xml");

    perry Guest

  3. #3

    Default Re: Flash and XML; using a lot of memory

    Is there a "right" way to dispose of the loaded file and the datagrid afterwards?
    Ken Guest

  4. #4

    Default Re: Flash and XML; using a lot of memory

    Ken wrote:
    > Is there a "right" way to dispose of the loaded file and the datagrid
    > afterwards?
    if you create the datagrid with attachMovie or duplicateMovieClip you
    can remove it with removeMovieClip();

    to free the xml object, you could load some empty xml data into it, for
    example a tree containing just one node.

    ..s
    somaboy mx Guest

Similar Threads

  1. Flash Player 8 huge memory using during drag (all memory gone in few minutes) !!!
    By LSopko@1024Informatica.com in forum Macromedia Flash Player
    Replies: 0
    Last Post: June 13th, 09:42 AM
  2. How Do I Load Data to Flash from memory
    By starkey_fan in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: August 4th, 06:43 PM
  3. Flash memory inside Director
    By FoolsErrand in forum Macromedia Director Basics
    Replies: 2
    Last Post: January 25th, 05:54 AM
  4. flash memory game HELP
    By mad_cartoonist webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: January 21st, 04:38 AM
  5. Flash memory dates in OSX
    By Clark Martin in forum Mac Portable
    Replies: 4
    Last Post: June 24th, 06:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139