android - Getting low memory warning but I don't appear to be leaking memory -


my application closing without error messages , re-launching automatically after switching activities approximately 20 or 30 times. i'm testing tapping button relaunches current activity different data (and cycles around beginning once end of data reached). activity launched flag_activity_clear_top flag there should ever 1 instance of activity in memory @ time. if set flag_activity_no_history problem still occurs.

this appears in logcat output when app crashes:

06-28 19:32:10.472: i/activitymanager(115): process com.mypackage.myapp (pid 3718) has died. 06-28 19:32:10.476: i/windowmanager(115): win death: window{406d06e0 com.mypackage.myapp/com.mypackage.myapp.welcome.loginactivity paused=false} 06-28 19:32:10.480: e/inputdispatcher(115): channel '406ade20 com.mypackage.myapp/com.mypackage.myapp.matchup.matchupactivity (server)' ~ consumer closed input channel or error occurred.  events=0x8 06-28 19:32:10.480: e/inputdispatcher(115): channel '406ade20 com.mypackage.myapp/com.mypackage.myapp.matchup.matchupactivity (server)' ~ channel unrecoverably broken , disposed! 06-28 19:32:10.535: i/windowmanager(115): win death: window{406ade20 com.mypackage.myapp/com.mypackage.myapp.matchup.matchupactivity paused=false} 06-28 19:32:10.539: i/windowmanager(115): win death: window{407a8230 com.mypackage.myapp/com.mypackage.myapp.fightcard.fightcardactivity paused=false} 06-28 19:32:10.566: i/activitymanager(115): start proc com.mypackage.myapp activity com.mypackage.myapp/.fightcard.fightcardactivity: pid=3915 uid=10053 gids={3003} 06-28 19:32:10.574: i/activitymanager(115): low memory: no more background processes. 

normally tell me app leaking memory, if perform test while watching ddms perspective in eclipse, can see allocated memory stable, , in fact app crash when % used sitting around 50% (which sits of time). heap size , allocated memory not increasing.

i have extensively used mat on app , while did find memory leaks previously, have solved them , can no longer find other problems tool.

i've been able recreate problem on nexus s running gingerbread, doesn't appear reproducible on galaxy nexus running 4.0.4 (however might due fact heap larger on galaxy).

what missing?

david wasser's suggestion above led me solution. noticed when ran command mentioned, getting whole bunch of custom font asset allocations:

zip:/data/app/com.mypackage.myapp-2.apk:/assets/dinnextltpro-mediumcond.otf: 98k 

these allocations appeared increasing changed activities. googling led me link: http://code.google.com/p/android/issues/detail?id=9904

so appears there android bug related using custom fonts. following workaround taken link above:

public class typefaces {     private static final string tag = "typefaces";      private static final hashtable<string, typeface> cache = new hashtable<string, typeface>();      public static typeface get(context c, string assetpath) {         synchronized (cache) {             if (!cache.containskey(assetpath)) {                 try {                     typeface t = typeface.createfromasset(c.getassets(),                             assetpath);                     cache.put(assetpath, t);                 } catch (exception e) {                     log.e(tag, "could not typeface '" + assetpath                             + "' because " + e.getmessage());                     return null;                 }             }             return cache.get(assetpath);         }     } } 

essentially we're caching instances of custom font asset each 1 needs instantiated single time.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -