Primary links

JVM Garbage Collectors and the Azul C4 (Continuously Concurrent Compacting Collector)

Jump to Summary Table

The main drawback of most garbage collectors is the need for long application pauses. These pauses are the result of an inevitable requirement to compact the heap to free up space. Collectors use different strategies to delay these events, but compaction is inevitable for all commercial available collectors except the Azul C4 which employs a Continuously Concurrent Compacting Collector that avoids pauses altogether.

The C4 (Continuously Concurrent Compacting Collector) is an updated generational form of the Azul Pauseless GC Algorithm and is the default collector of the Zing JVM. C4 differentiates itself from other generational garbage collectors by supporting simultaneous - generational concurrency: the different generations are collected using concurrent (non stop-the-world) mechanisms that can be simultaneously and independently active. Unlike other algorithms, it is not ‘mostly’ concurrent, but fully concurrent, so it never falls back to a stop-the-world compaction.

A summary of garbage collectors is below. For more information on the terminology and more details on the collectors, read the Understanding Java GC white paper.

JVMCollector NameYoung GenerationOld Generation

Oracle HotSpot

ParallelGC

Monolithic, stop the world, copying

Monolithic, stop-the-world, Mark/Sweep/Compact

Oracle HotSpotCMS (Concurrent Mark/Sweep)Monolithic, stop the world, copyingMostly concurrent marker, concurrent, non-compacting sweeper, fall back to monolithic stop-the-world compaction
Oracle HotSpotG1 (Garbage First)Monolithic, stop the world, copyingMostly concurrent marker, mostly incremental compaction, fall back to monolithic stop-the-world
Oracle JRockit*Dynamic Garbage CollectorMonolithic, stop-the-world, copyingMark/Sweep - can choose mostly concurrent or parallel, incremental compaction, fall back to monolithic stop-the-world
IBM J9*BalancedMonolithic, stop-the-world, copyingMostly concurrent marker, mostly incremental compaction, fall back to monolithic stop-the-world
IBM J9*optthruputMonolithic, stop-the-world, copyingParallel Mark/Sweep, stop-the-world compaction
Azul ZingC4 (Continuously Concurrent Compacting Collector)Concurrent, compactingConcurrent, compacting

Garbage Collection (GC) is an integral part of application behavior on Java platforms. Java developers can improve application performance, scalability and reliability by understanding how GC works and by making better garbage collector choices.

More resources:

*Note that with J9 and JRockit you can choose to have a single or 2-generation garbage collector