PDA

View Full Version : With phonegapbuild,my app's memory is always growing,larger and larger.help!!!



fanyuelin555
10 Jul 2012, 10:48 PM
i
n my sencha touch 2 application i use a map panel for displaying a map with about 20 - 30 different markers and a polyline. My Problem is, that every time i go to the map panel the memory usage of the app is rising about 2-5 MB. This leads to several memory warnings in iOS and at the end my app is killed by the system. Here are the things i already have done to minify memory usage:

only instantiate the visible panel, destroy panels when no longer visible
clear all Listeners on the map when leaving the map wit google.maps.event.removeListener()
try to avoid javascript memory leaks

My app is wrapped with PhoneGap but when i run my app as a pure webapp in the mobile safari browser the memory warings also appear an then app(mobile safari browser) is killed.I just wanted to know if anybody else had similar memory isssues?It's interesting, that even if a build a complete new app with the sencha sdk tools and just add a MapPanel with nor markers and no extra logic it is also possible to get memory warnigns and an app crash after some interaction with the map(zoom in, zoom out, pan etc.)

arthurakay
11 Jul 2012, 6:28 AM
Here are the things i already have done to minify memory usage:

only instantiate the visible panel, destroy panels when no longer visible
clear all Listeners on the map when leaving the map wit google.maps.event.removeListener()
try to avoid javascript memory leaks


Not to be captain obvious, but it's clear you have JavaScript memory leaks. :-?

If I had to guess, the markers/polylines might be to blame here. They probably aren't directly tied to your components, so those objects (and their DOM references) aren't destroyed when the panels/maps are destroyed.

But that's just a blind guess. It's hard to say for sure without seeing your entire application.