How does the Garbage-First Garbage Collector work?

The collector splits the heap up into fixed-size regions and tracks the live data in those regions. It keeps a set of pointers — the “remembered set” — into and out of the region. When a GC is deemed necessary, it collects the regions with less live data first (hence, “garbage first”). Often, this can mean collecting an entire region in one step: if the number of pointers into a region is zero, then it doesn’t need to do a mark or sweep of that region.

For each region, it tracks various metrics that describe how long it will take to collect them. You can give it a soft real-time constraint about pause times, and it then tries to collect as much garbage as it can in that constrained time.

There is JavaOne talk about G1 and few articles on the topic:

  • http://developers.sun.com/learning/javaoneonline/j1sessn.jsp
  • http://www.fasterj.com/articles/G1.shtml
  • http://www.drdobbs.com/java/219401061
  • http://www.infoq.com/articles/G1-One-Garbage-Collector-To-Rule-Them-All

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)