Deconstructing the garbage-first collector

Garbage-First is among today's most widely used garbage collectors. It is used in the HotSpot and OpenJDK virtual machines, and shares algorithmic foundations with three other important contemporary collectors: Shenandoah, C4, and ZGC. However, the design of the core algorithms and the performance tradeoffs they manifest have not been carefully analyzed in the literature. In this work, we deconstruct the G1 algorithm and re-implement it from first principles. We retrospectively develop a concurrent, region-based evacuating collector, CRE, which captures the principal design elements shared by G1, Shenandoah, C4, and ZGC. We then evaluate the impact of each of the major elements of G1 on performance, including pause time, remembered set footprint and barrier overheads. We find that G1's concurrent marking and generational collection reduces the 95-percentile GC pauses by 64% and 93% respectively. We find that the space overhead of G1's remembered sets is very low, typically under 1%. We also independently measure the barriers used by G1 and find that they have an overhead of around 12% with respect to total performance. This analysis gives users and collector designers insights into the garbage-first collector and the other fixed-size region-based concurrent evacuating collectors, which we hope will lead to better use of the collectors and provoke future improvements.

[1]  Bernard Lang,et al.  Incremental incrementally compacting garbage collection , 1987, PLDI.

[2]  Taiichi Yuasa,et al.  Real-time garbage collection on general-purpose machines , 1990, J. Syst. Softw..

[3]  Rajiv Arora,et al.  Java server performance: A case study of building efficient, scalable Jvms , 2000, IBM Syst. J..

[4]  Andrew Dinn,et al.  Shenandoah: An open-source concurrent compacting garbage collector for OpenJDK , 2016, PPPJ.

[5]  Rodney A. Brooks,et al.  Trading data space for reduced time and code space in real-time garbage collection on stock hardware , 1984, LFP '84.

[6]  Xi Yang,et al.  Taking off the gloves with reference counting Immix , 2013, OOPSLA.

[7]  David M. Ungar,et al.  Generation Scavenging: A non-disruptive high performance storage reclamation algorithm , 1984, SDE 1.

[8]  Vivek Sarkar,et al.  The Jikes Research Virtual Machine project: Building an open-source research community , 2005, IBM Syst. J..

[9]  Xi Yang,et al.  Barriers reconsidered, friendlier still! , 2012, ISMM '12.

[10]  Kathryn S. McKinley,et al.  Immix: a mark-region garbage collector with space efficiency, fast collection, and mutator performance , 2008, PLDI '08.

[11]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[12]  John McCarthy,et al.  Recursive functions of symbolic expressions and their computation by machine, Part I , 1960, Commun. ACM.

[13]  Henry Lieberman,et al.  A real-time garbage collector based on the lifetimes of objects , 1983, CACM.

[14]  Michael Wolf,et al.  The pauseless GC algorithm , 2005, VEE '05.

[15]  Michael Wolf,et al.  C4: the continuously concurrent compacting collector , 2011, ISMM '11.

[16]  David Detlefs,et al.  Garbage-first garbage collection , 2004, ISMM '04.

[17]  Paul R. Wilson,et al.  A “card-marking” scheme for controlling intergenerational references in generation-based garbage collection on stock hardware , 1989, SIGP.

[18]  Kathryn S. McKinley,et al.  Age-based garbage collection , 1999, OOPSLA '99.

[19]  DiwanAmer,et al.  The DaCapo benchmarks , 2006 .

[20]  J. Eliot B. Moss,et al.  Incremental Collection of Mature Objects , 1992, IWMM.

[21]  Perry Cheng,et al.  Oil and water? High performance garbage collection in Java with MMTk , 2004, Proceedings. 26th International Conference on Software Engineering.

[22]  Chris J. Cheney A nonrecursive list compacting algorithm , 1970, Commun. ACM.

[23]  Lu Fang,et al.  Speculative region-based memory management for big data systems , 2015, PLOS@SOSP.

[24]  Stephen M. Blackburn,et al.  Barriers: friend or foe? , 2004, ISMM '04.

[25]  Robert Fenichel,et al.  A LISP garbage-collector for virtual-memory computer systems , 1969, CACM.

[26]  William D. Clinger,et al.  Generational garbage collection and the radioactive decay model , 1997, PLDI '97.