Device memory is Low issue for an WebWork app

I am developing an WebWork app which calls a lot of XML data from the web server and display it on the page. The problem we have encountered is that after we have upgraded our Torch to 6.0 Bundle 2475, after we have used the app to load data for a few times, the app will say "Device Memory is Low" and request to close some opened application......

For sure I have only opened my application only and we have only used it for while, and after a few more click, the system will force the app to quit.

Some said this is RIM OS6 Bundle 2475 BUG and there must be a wait to handle this right?

RIM PLEASE HELP OR ANYONE BETTER THEN RIM, PLEASE HELP!!!

Any method we can clear up the cache or reduce the memory usage?

Programming style:

We are using several HTLM pages to call different screen. Each page load required to send request to the server and receive XML data.

Re: Device memory is Low issue for an WebWork app

We have found similar issues which narrow down to using the Browser Field that is used to render the content which does have a memory issue in certain situations.

You can minimize the impact by reducing the number of times you change the location of the document. Loading a bunch of pages in sequence can aggrevate the issue. If your application is built as a single page while loading other content via AJAX the issue is less apparent.

Closing your app and re-opening it will not resolve the issue, it is a memory issue in the Browser Field that we are developing a work around in WebWorks to deal with the issue.

We have a solution in progress. First will likely see an incremental solution, followed by a full solution.

In parallel the Browser team has fixed the root of the issue in upcoming BB6 releases and it has been resolved in BB7

Re: Device memory is Low issue for an WebWork app

If we do this, we will need to create a new page and include all the javascript function into the same page.... and use link to call and then include others page into this "Master Page"

To do, will this for sure solve the memory issue? This is a very big modification process. This nearly completely rewrite our app. We really want to make sure this will work before starting the modification.

Also, is this the programming style which RIM advise developer to do? A style / direction which will work for OS7 and future OS?

Re: Device memory is Low issue for an WebWork app

This would be our recommended programming style for WebWorks apps. Basically moving from page to page means the DOM gets destroyed and re-created each time and your JavaScript needs to be re-parsed. For the most performant application this style works best.

These changes will not guarantee a "fix" for the problem, but will further minimize the chances of this happening. A fix in the WebWorks framework is underway to work around this bug in the Browser Field

Re: Device memory is Low issue for an WebWork app

As you mentioned about DOM, in fact, in my app, almost each page call XML from Internet (and of course it use DOM), are there any solution on DOM problem for the XML calling? And also, I am planning to use JSON for future version (not in this version), will it have DOM problem or other problems?

Re: Device memory is Low issue for an WebWork app

There really isn't a DOM problem. The problem is when the document changes locations. Changing locations requires the old document to be tore down and the new one created.

This is at the root of the issue that you are having. Right now there is an issue in Browser Field where the old DOM (while it has been tore down) is still in memory. Thus causing a leak. So multiple page changes (URL of page changes) causes the leak to grow.

This has been fixed in newer BB6 builds and also fixed in BB7. For affected BB6 devices we are building a solution into the WebWorks framework to detect these situations and pro-actively clean up the leak created by the Browser Field.