Java - available garbage collection algorithms [cl

2019-01-31 09:35发布

问题:

Does anyone know a proper resource to read on the available garbage collection mechanisms in java? So far I found a couple of websites but they did not contain a comprehensive description with respect to when to use which and what the implementation was. (I am referring to Oracle's jdk)

回答1:

As of today, there are 4 GC algorithms available in the Java Hotspot VM:

  • The Serial GC - recommended for client-style applications that do not have low pause time requirements.
  • The Parallel GC - use when the throughput matters.
  • The Mostly-Concurrent GC (also known as Concurrent Mark-Sweep GC(CMS)) - use when the latency matters.
  • The Garbage First GC (G1) - new GC algorithm, for CMS replacement.

You can find more information about these GC algorithms in the references below.

Books:

  • Java Performance - practical guide, contains chapters on GC, explains comprehensively when and how to use various Hotspot GC algorithms,
  • The Garbage Collection Handbook - Garbage-Collection theory explained, mentions all available GC techniques.

Talks/Articles:

  • Java One 2012 Advanced JVM Tuning
  • Java One 2012 G1 Garbage Collector Performance Tuning
  • Garbage Collection Tuning Guide
  • Java HotSpot Garbage Collection

Mailing List:

  • OpenJDK Hotspot GC Use


回答2:

Check out this website www.cubrid.org/blog/tags/Garbage%20Collection/. It has a suite of five articles describing gc from concept to details and use cases.
I guess you are probably looking at this one in particular.