Over a million developers have joined DZone.

Android 5.0 & ART: A Compacting Garbage Collector is Coming

DZone's Guide to

Android 5.0 & ART: A Compacting Garbage Collector is Coming

· Mobile Zone
Free Resource

Launching an app doesn’t need to be daunting. Whether you’re just getting started or need a refresher on mobile app testing best practices, this guide is your resource! Brought to you in partnership with Perfecto

Google I/O shook things up a bit last week - ART is finally for sure (or more for sure, I guess), and now we've seen some cool new developer tools - but one significant aspect of ART that didn't get covered is garbage collection. According to the updated ART documentation, a compacting garbage collector is coming to AOSP.

If you're not familiar with compacting garbage collectors, this is a pretty cool development. Mark Murphy on The CommonsBlog has covered the development in detail, and sums it up succinctly:

With a compacting garbage collector, the long-lived objects get slid around in memory, to allow the freed-up blocks of memory to be coalesced. The net is that all free heap space should be available as one contiguous block, eligible for allocation.

Dalvik's garbage collection, on the other hand, is non-compacting. That means that when you free up space in memory, it doesn't get reorganized into usable blocks - it stays where it is.

That's a promising development for Android developers. As Murphy notes, if compacting garbage collection is coming to ART and ART is coming to Android 5.0, we're looking at a future with much more reasonable memory management in Android by default.

Or, for a simpler conclusion from Murphy:

I, for one, welcome our new ARTist overlords.

Keep up with the latest DevTest Jargon with the latest Mobile DevTest Dictionary. Brought to you in partnership with Perfecto.

java ,mobile ,art ,garbage collection ,tips and tricks ,memory management ,tools & methods ,aosp ,android 5.0

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


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

{{ parent.tldr }}

{{ parent.urlSource.name }}