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 579 posts at DZone. You can read more from them at their website. View Full User Profile

Android 5.0 & ART: A Compacting Garbage Collector is Coming

  • submit to reddit

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.


Jonathan Fisher replied on Mon, 2014/06/30 - 10:38pm

... So sad they just didn't port OpenJDK or even just the base JVM. They'd be out the TCK, but since they're already out of compatibility with the Android APIs, wouldn't really matter. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.