01-04-2012 12:27 PM
Hi there,
I've isolated from my application a test case that proves the memory leak in WebWorks 2.2 when using focused based navigation.
I guess that RIM developers would be interested in taking a look into this. Please include jquery when building the example, and also an img (anyone will do).
I've tested this using a Bold 9780 running OS 6.0.0.706. The application runs a script that loads a set of images, removes them from the DOM, and back again. Less than a minute after starting, a memory low warning alert will appear, and the application is closed.
As a bonus, if you add an application icon, after the application is closed, your application icon will be replaced by the default icon.
Thanks for your interest.
config.xml:
<?xml version="1.0" encoding="UTF-8"?> <widget xmlns="http://www.w3.org/ns/widgets" version="1.0.10.857" > <name>LP20</name> <author>Tests Inc.</author> <content src="landing.html"/> <rim:navigation mode="focus"/> </widget>
landing.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>WWLeak</title> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no, minimum-scale=1, maximum-scale=1" /> <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> <script type="text/javascript"> function cleanup() { $('#container').children().remove(); } function redraw() { cleanup(); var div = $('<div>'), i; for (i=0; i<300; i++) { div.append('<img src="image.png" x-blackberry-focusable="true">'); } $('#container').append(div); } $(function() { setInterval( function() { redraw(); }, 5000 ); }); </script> </head> <body> <div id="container"> </div> </body> </html>
Others:
01-04-2012 02:49 PM
Thanks MLUY,
We're definately looking into it
button below the post(s)01-11-2012 08:20 AM
Hi, I hope you were able to reproduce this, have you?
I'm pretty much interested in the second part of the problem: the application icon changes after the application crashes. Have you been able to reproduce this also?
01-11-2012 08:36 AM - last edited on 01-11-2012 08:42 AM
Hi MLUY,
We were able to reproduce the issue sorry for not posting that earlier. There were some device models where it doesn't happen and some where it does but no matter what the impact was much improved using 2.3 (if not completely fixed).
As per the icon, I'll double check with the testing team and post back.
button below the post(s)01-11-2012 09:55 AM
Can you share on which devices you were/weren't able to reproduce this?
I was told by devsupport that the issue is still present in 2.3.
Please let me know your findings about the icon changing problem.
Thanks
01-12-2012 08:21 PM
Hi MLUY,
I believe the majority of devices that did not reproduce were recent 7.0 devices.
As per the icon, did you mean if you added the icon through the API or had it in the config.xml. We tested with an icon in the config.xml and did not see it change in any way.
button below the post(s)02-09-2012 10:35 AM
Hi,
is any workaround on this problem. In my case error occurs when we display only 25 pics.
BR
02-13-2012 10:26 AM
Anybody resolved our issue, if no maybe the only way is give feed back to our sponsor that there is no way to develop apps on bb 6.0 and we should waiting for new os releases ?
Is any way to escalate problems from this forum ?
02-13-2012 05:49 PM
What happens if you add and remove the images using standard JavaScript DOM mainipulation instead of using jQuery.
Have you tried adding the images all through a document fragment and then inserting them in the live DOM vs loading them individually?
In your existing code, each append of the <div> will trigger a layout computation and then a re-indexing of the focus based navigation tree which all also use memory.
Have you tried disabling focus based navigation? Does it make any difference?
02-13-2012 05:55 PM
Hi tneil, thanks for the interest.
This issue only happens with focus based navigation. If you disable, the sample application runs like 3 hours without problem (instead of less than one minute).
I don't have time now to try any other of your suggestions. In fact, I removed focus based navigation and really don't plan to re-enable it.
The guy from dev support tried the following, neither of them helped:
A few changes I tried:
1) Using the HTML5 <!DOCTYPE html> declaration.
2) Newer JQuery version (1.7.1)
3) Instead of removing and appending children, leveraging the html('') method to clear the HTML of the container.
4) When adding multiple <image> elements, storing all items in a String, then making only one call to html(stringOfAllElements).
5) Leveraging recursive calls to setTimeout() instead of the initial call to setInterval().