The Garbage-First (G1) collector

Posted lnas01

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The Garbage-First (G1) collector相关的知识,希望对你有一定的参考价值。

The Garbage-First (G1) collector is a server-style garbage collector, targeted for multi-processor machines with large memories. It meets garbage collection (GC) pause time goals with a high probability, while achieving high throughput. The G1 garbage collector is fully supported in Oracle JDK 7 update 4 and later releases. The G1 collector is designed for applications that:

Can operate concurrently with applications threads like the CMS collector.
Compact free space without lengthy GC induced pause times.
Need more predictable GC pause durations.
Do not want to sacrifice a lot of throughput performance.
Do not require a much larger Java heap.

 

G1 is planned as the long term replacement for the Concurrent Mark-Sweep Collector (CMS). Comparing G1 with CMS, there are differences that make G1 a better solution. One difference is that G1 is a compacting collector. G1 compacts sufficiently to completely avoid the use of fine-grained free lists for allocation, and instead relies on regions. This considerably simplifies parts of the collector, and mostly eliminates potential fragmentation issues(碎片问题). Also, G1 offers more predictable garbage collection pauses than the CMS collector, and allows users to specify desired pause targets(设置预期停顿时间).

 

 





以上是关于The Garbage-First (G1) collector的主要内容,如果未能解决你的问题,请参考以下文章

G1垃圾回收器学习

G1 垃圾收集器

G1 垃圾收集器

G1 垃圾收集器

深入理解Java虚拟机——G1收集器

Java虚拟机G1垃圾收集器详解