O'Reilly logo

Android UI Design by Jessica Thornsby

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Spotting memory leaks

Android may be a memory-managed environment, but you still need to scrutinize how your app is handling memory.

Garbage collection (GC) can only remove objects that it recognizes as unreachable. If your app allocates objects that the Android system doesn't identify as unreachable, then those objects are never going to get garbage collected. They're going to hang around, polluting your heap, and taking up valuable space.

As your app continues to leak objects that the system can't garbage collect, the amount of usable space will get smaller and smaller. The Android system will try to compensate for this shrinking memory by running longer and more frequent GC events.

While your typical GC event won't have a noticeable impact on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required