Mobile Zone is brought to you in partnership with:

Alec is a Content Curator at DZone and lives in Raleigh, North Carolina. He is interested in Java and Android programming, and databases of all types. When he's not writing for the NoSQL and IoT Zones, you might find him playing bass guitar, writing short stories where nothing happens, or making stuff in Java. Alec is a DZone Zone Leader and has posted 578 posts at DZone. You can read more from them at their website. View Full User Profile

How to Handle Memory Management in Android

03.07.2014
| 9916 views |
  • submit to reddit

Memory management is a serious issue for Java development. When it comes to Android, though, things are a little different: consequences are limited to your individual app, rather than system-wide catastrophes. That means you might need some different strategies, and this recent article from Joe Mahon at Raizlabs provides a few tips to help you out. Mahon's tips come in the form of lessons - seven in total - such as:

  • Search for memory leaks even when things aren't failing
  • Keep track of your references
  • Be aware that the Android GarbageCollector is clumsy
  • Don't hang on to references to activities

And a few more. For each, Mahon explains what types of issues might arise, and how to fix them. It's a pretty helpful guide to some of the nuances of Android memory management, and Mahon really drives home the importance of the issue, too:

Utilize prayer, lucky rabbit feet, or indomitable willpower in the face of the inevitable flood of negative reviews when you ignore this issue.

Check out Mahon's full article, and also be on the lookout for part 2 sometime soon!