Question

I am facing the problem of low memory. Low memory:no more background process And here is the scenario.

I am using a list which gets its data from a string array, it has a custom background, Clicking on item, the list gets another string array to display as second or third level. Information for three levels written in database.

After third level, there are two more levels for which data is going to be fetched from web services,

And that causes the low memory error.

How can I get rid of the solution?

Edit : After having some digging I found that the GC is trying to (kill or) restart in case of its already crashed com.android.inputmethod.latin/.latinIMEservice. One notable point is that the application is translated in french and italian, but this screen does not have any text for translation, does this information helps??

Edit 2: After a detailed study of traceview I found that all the text views have custom fonts applied in it. (There is a call of TypeFace.createFromAsset()) that IMO causes the crashes.

And the problem lies in the fact that I have to keep the fonts.... can It be possible to avoid crash and have the fonts?? (Because i think the answer is no: But still waiting for some opinions)

Edit 3 : After removing the custom fonts the performance of application is much better. Hence I can suspect the font is the only culprit here. And that's why I am editing question. The font I use is helvetica.

Can using external fonts cause application to crash or running out of memory? If yes can you describe the cause in more detail??

Thanks

Was it helpful?

Solution

If you are using code similar to:

Typeface font = Typeface.createFromAsset(getContext().getAssets(),
"fonts/Helvetica.ttf");

try making "font" a global variable so it only gets loaded once. Otherwise it can be loaded repeatedly, quickly consuming memory. See this message for a little more detail

OTHER TIPS

Well, question is a bit unclear to have answered:

  1. After each level - do you switch/start to another Activity? If so you shouldn't keep anywhere references to old activity. Otherwise it could trigger OOM problems
  2. I suppose you're fetching data using some kind of Cursor alike object. Cursor's are very memory-consuming objects, so you'd better not only just close Cursor's, but you should also call Cursor.deactivate()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top