×

Discussion Board

Results 1 to 8 of 8

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    10

    Question About "Out of memory"

    Hi!
    My web app is a photo viewer, which gets 6 photos once from my web server and shows these photos in one page. The user can tap "next page" button on toolbar to fetch the next 6 photos. I use mwl.insertHTML() to replace the old photo page with the new.
    But after tap and tap "next page", about dozens of times, the app crashes with "out of memory" error. I think whether the html and photo images was not released when mwl.insertHTML() called frequently? If so, how can I release the memory before mwl.insertHTML() was called? Or, there are other problems?
    Please give me any help.
    BRD.
    Last edited by boq; 2011-07-15 at 09:07.

  2. #2
    Registered User
    Join Date
    Jun 2011
    Location
    Nasik India
    Posts
    39

    Re: About "Out of memory"

    I had also face the same problem in my J2ME S40 app, have solved that problem by calling system.gc() method.

  3. #3
    Super Contributor
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: About "Out of memory"

    Hi,

    Could you share some code? I would help to get started and to find possible fixes.

    Br,
    Ilkka

  4. #4
    Registered User
    Join Date
    May 2011
    Posts
    10

    Re: About "Out of memory"

    Quote Originally Posted by isalento View Post
    Hi,

    Could you share some code? I would help to get started and to find possible fixes.

    Br,
    Ilkka
    Hi isalento,
    My code is bellow, this function handles the response of the http request called by the "next page" button.

    function onPhotoList(xmlDoc){
    var html = '<div class="tab_mag">';
    html += '<table id="m_tab" cellspacing="2" border="0" style="border-collapse:collapse;" summary=""><tr>';
    var recSets = xmlDoc.getElementsByTagName("rsp")[0];
    for (var i = 0; i < recSets.childNodes.length; i++){
    if (i > 0 && i % 3 == 0){
    html += '</tr><tr><td style="height:5px" /></tr><tr>';
    }
    var rec = recSets.childNodes[i];
    var obj = new Object();
    for (var j = 0; j < rec.childNodes.length; j++){
    if (rec.childNodes[j].hasChildNodes()){
    obj[rec.childNodes[j].tagName] = rec.childNodes[j].firstChild.nodeValue;
    }
    };
    html += '<td onclick="g_inSearch = false;getPhotoInfo(parseInt(' + obj["id"] + '))" valign="top">';
    html += '<div><img src="http://12.34.56.78/images/';
    html += obj["img"] + '" alt="' + obj["type"] + '" width="60" height="85" />';
    html += '</div><div>' + obj["qishu"] + '</div></td>';
    obj = null;
    rec = null;
    }
    html += '</tr></table></div>';
    mwl.insertHTML("#channel_list", html);
    mwl.switchClass('#views', 'view0', 'view1');
    recSets = null;
    html = null;
    }

  5. #5
    Super Contributor
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: About "Out of memory"

    Thanks for the code.

    I couldn't instantly reproduce the problem with a hacked version of mine.
    What device are you using for testing?
    How big are images that you try to load?

    -Ilkka

  6. #6
    Registered User
    Join Date
    May 2011
    Posts
    10

    Re: About "Out of memory"

    Hi isalento,
    Our test device is X3-02.
    Every image size is 60x85pix, about 5KB.
    The error always appears after 20-30 page turning.
    I think the problem may be caused by xml parse, or mwl.insertHTML(), right?
    Last edited by boq; 2011-07-20 at 02:14.

  7. #7
    Registered User
    Join Date
    May 2011
    Posts
    10

    Re: About "Out of memory"

    Yes, system.gc() is effective in java, but how can I make the save effect in S40 web apps?

Similar Threads

  1. Replies: 4
    Last Post: 2010-08-17, 09:39
  2. How to handle error "Out of Memory"
    By prashant.sharma in forum Symbian
    Replies: 3
    Last Post: 2010-07-09, 17:00
  3. mwldsym2.exe Linker "out of memory"
    By jmhautbois in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2008-07-11, 16:31
  4. "Out of Memory" not "java.lang.OutOfMemoryError
    By muditkmathur in forum Mobile Java General
    Replies: 3
    Last Post: 2007-08-08, 13:21
  5. Strange "Out of memory"-error on 7210-emulator...
    By martin1302 in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2003-11-25, 23:31

Posting Permissions

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