Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
kiranmobile
Posts: 44
Registered: ‎08-28-2009
My Device: Not Specified

Re: Device memory is Low issue for an WebWork app

I moved all my code from the second page to the first page inside a DIV and selectively displaying it now. The out of memory error still occurs however I seem to have delayed it a bit.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Device memory is Low issue for an WebWork app

If your application is using large images, large DOMs or JavaScript toolkits that use up the available memory set aside for the webkit engine on the device you will receive the low memory warning asking you to close down other applications.  Unfortunately there's no silver bullet that will extend the amount of physical memory allocated for the webkit engine used for apps.

 

You will need to make sure that you are managing the memory as best as you can and also using toolkits that can play within the memory limits of the device.

 

One of the things that I did in creating bbUI.js was to create a framework for loading screens in the most memory/performance concious way.  If you have multiple DIVs in one page and then showing/hiding them, you are using up memory for each one of those DIVs by simply having them loaded.

 

The bbUI toolkit loads in screens as HTML fragments as needed and then discards them from memory when it is done with them.  It also does all DOM manipulation disconnected from the live DOM to increase speed of execution as well as reducing as many webkit layouts as possible which reduces memory needed.

 

JavaScript on BB7 has a very fast Javascript engine... The BB7 Torch is 36ms slower than iPhone 4Gs with iOS 5 on Sunspider tests.

 

Where you get slow downs on any web page is re-layouts, manipulating the live DOM through JavaScript will re-layout your page multiple times.  Reducing this increases both the speed of your app and its memory requirements

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
New Developer
kiranmobile
Posts: 44
Registered: ‎08-28-2009
My Device: Not Specified

Re: Device memory is Low issue for an WebWork app

Neil: I must really appreciate your efforts towards building such a framework. It truly resembles and applies a classical push and pop screen approach to webworks sdk. Looking at the samples and article my first impressions are that it requires quite a bit of effort for app developers to retrofit their existing apps to adapt to this approach. Is this also your expectation? Do you think app developers are going to make the extra effort to do this. Also what happens if they rely heavily on trackpad navigation? In any case overall it's a pretty good effort to solve the something which should inherently have been part of the sdk to begin with.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Device memory is Low issue for an WebWork app

The concepts of the toolkit are based in solid cross platform mobile web optimizations. So they are good practice for any mobile web app.

On slower devices it will perform well, and on faster devices it will be very fast!

The toolkit automatically handles all trackpad navigation for you. If you use any of the lists or controls it will handle all highlighting, selections and clicks.

It's up to each developer to decide if using these methods make sense to them.. For me it fit my needs and I figured I would share it with the community.

Ken (kwallis) has been making some updates to bbUI so that it will use the webworks v2.3 Navmode dialogs.. Should be cool :smileyhappy:
Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Regular Contributor
MLUY
Posts: 51
Registered: ‎07-20-2011
My Device: PlayBook
My Carrier: RIM

Re: Device memory is Low issue for an WebWork app

Hi TNeil, 

 

Some weeks ago I've provided a very simple test case that shows the memory problem when using focus based navigation, here is the link:

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Memory-leak-using-focused-based-...

 

This seems to be a problem also in WW 2.3. Do you have any comments on that? 

Please use plain text.
Contributor
joygupta
Posts: 31
Registered: ‎05-06-2011
My Device: 9300
My Carrier: developer

Re: Device memory is Low issue for an WebWork app

Hi, 

Please look into the following code example. There seems to be some memory leakage in the date control field.

 

My html page contains following control:-

 

<input class="mandatoryfield" onblur="javascript&colon;ChangeDateFormat(this)" type="datetime-local" name="Datetime_IncidentDate" id="Datetime_IncidentDate"/>

 

And the js file contains the following function:-

 

//*********Function to Implement the Date-Format***************//
function ChangeDateFormat(objectDate){
try {
if(objectDate.value.indexOf("-")>=0)
{
date =objectDate.value;
var DateArray = date.split("-");
var DayTime = DateArray[2];
var DayTimeArray=DayTime.split("T");
var Time=DayTimeArray[1];
var TimeArray=Time.split(":");
var hours =TimeArray[0];
var minutes =TimeArray[1];
var day=DayTimeArray[0];
var month = DateArray[1];
var year = DateArray[0];
var newDate=day+"/"+month+"/"+year+"    "+hours+":"+minutes;
objectDate.value=newDate;
}
} catch (e) {
show_alertforException(e.toString());
}
}

 

Now whenever I open the page, and doesn't click on the date control and returns back, there is no memory consumption(after the watch dog runs), now when i again open the page and clicks on the date control and select the date from the pop-up, and returns back from that page, there is a memory leak(of aroung 200KB) after the watch dog runs.

Is there any short of thing i am missing. 

Note:-

1. i am using latest webworks SDk 2.3

2. i am testing on device-9780 -OS-6.0

 

Hope to get a response as sson as possible because I have to deliver my code.

Please use plain text.
Contributor
raj786
Posts: 11
Registered: ‎08-05-2011
My Device: Developer
My Carrier: Developer

Re: Device memory is Low issue for an WebWork app

Hi guys

 

I have been following this thread closely, but haven't posted yet.

 

We are building an app to target OS6/OS7, using the WebKit (2.3). We do have a requirement of using maps, being able to run the app in the background, and like most other developers we are struggling with the memory leaks when using JQuery along with Google Maps (v3).

 

On some of the Torches (OS6), it simply crashes the app without any warning. On other Torches (OS6), it complains about the memory and then shuts down; same symptoms as the ones that are posted here for a while now.

 

We really want to get this app out on the BB platform rather than give up and scrap it, and we are looking for any help from other developers or from RIM in figuring out if there is a fix, hack, or workaround to this problem yet?

 

Tim: I saw your https://github.com/tneil/bbUI.js  And I really appreciate that. Have you been able to use that, along with Google Maps, and successfully run that on a Torch without having it crash within 30 minutes? Would you be able to post an example, especially one that runs on both OS6 and OS7 (on OS7, the map doesn't even load within an app, does load within a browser though)? 

 

Or is RIM's position to recommend (for whatever official reason) that developers not us Google Maps API for BB apps right now? And if that is the position, is there an alternative comprehensive API that RIM (or any other developer?) has tested that would work in this case? Is there any example of this, again that works on OS6/OS7 on Torch without crashing?

 

I apologize if the tone sounds harsh above, I am trying not to sound harsh and focus simply on a solution that works. We have been been passionate about creating this app using the Webkit and release it on the BB smartphones, but feel like we are being really let down by RIM especially since it's been a while since these problems were reported and while it seems there have been multiple attempts to narrow it down and fix it, I cannot imagine that it would take this long to fix something so important to the success of the BB platform for smartphones.  Google Maps API is used on iOS and Android by several apps. 

 

I'd be really interested in finding out from the rest of the developers who posted about the same issues, did you guys just scrap it and move to iOS and Android, or did you guys find a workaround/hack/fix/anything at all?

 

 

Thanks.

Please use plain text.
Developer
shnuffy
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: Device memory is Low issue for an WebWork app

Since I support OS5 (50% of users still), and my app needs maps, I opted to use the static version of Google Maps API, which simply returns a static image given some parameters. Obviously, we lose out on all the interactive things that make Google Maps (with controls) so awesome, but the static image requires substantially less memory. Pretty disappointed still though. 

Please use plain text.
Contributor
raj786
Posts: 11
Registered: ‎08-05-2011
My Device: Developer
My Carrier: Developer

Re: Device memory is Low issue for an WebWork app

[ Edited ]

Thanks shnuffy.

 

So you show the static map even for OS6/7 ? Does the (static or interactive?) map show up on OS7?

 

We do have a requirement for interactive maps unfortunately.

 

Ideally, we do want to support OS5 as well, because yea as of Dec 2011, I think they still account for 48%(?), but it's just been riddiculously painful trying to get this app finished at this point:

- Moved from Java to HTML5 

- Dealt with complete lack of support for Facebook authentication. Finally got this working with the motek browser extension.

- Running the app in the background causing memory leaks (seems to have subsided I think?) 

- JQuery memory troubles

     - Currently trying to get around by implementing Tim's bbUI.js alongside zepto.js (for ajax support). Memory leak does seem to have gone down, app doesn't crash!, but testing some more tonight. 

- Continued Google Maps API memory leaks on OS6 / no visiblity at all on OS7

     - Trying a couple of other (open source) map alternatives and will try to post a working example once I finish. 

 

We are going to spend a couple more business days on this and if we can't find a solution to it, we are going to have to abandon the BB platform and focus on iOS and Android.  

 

Please use plain text.
Contributor
konradz
Posts: 13
Registered: ‎02-09-2012
My Device: Blackberry 9700 Bold
My Carrier: Orange

Re: Device memory is Low issue for an WebWork app

raj786: I think there is no sense to develop apps on blackberry, they've got plenty errors and support forum doesn't work. Nobody response in crutial threads.

 

We're developing apps in phonegap technology with jquery mobile and openlayers and we have plenty of errors. I will be recommend to our sponsor to kill BlackBerry track. Maybe WP is better alternative for iOS and Android.

 

BR

Please use plain text.