Over a million developers have joined DZone.

How to Handle Memory Management in Android

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

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!

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}