Android bitmap memory management

On my current app I eventually ran into the dreaded out of memory errors.
As my heart sunk I stripped out my animation code and went on a reading rampage to try and figure out not just what a memory leak is, but how to identify them in my code, how to fix them, and how to prevent them from happening in the future.

This post will be a collection of the most useful and relevant information I found on the subject, sprinkled with my own insights.

The first thing to know is well just what the hell is a memory leak in the first place?
Wikipedia defines a memory leak.

How do I identify the memory leak?
The android dev environment provides some useful tools in its DDMS suite. They are a little intimidating and confusing but don’t worry, I’ll do my best to explain it.

Now that we’ve identified our memory leak, well how do we fix it?
This article deals primarily with bitmap related memory leaks.
Some useful starting points are here;
http://mobi-solutions.blogspot.com/2010/08/how-to-if-you-want-to-create-and.html
and here:
http://code.google.com/p/android/issues/detail?id=8488
and here:
http://developer.android.com/resources/articles/avoiding-memory-leaks.html

and here:
http://www.curious-creature.org/

More to com

Leave a Reply

Your email address will not be published. Required fields are marked *