0% found this document useful (0 votes)
0 views2 pages

Modern Garbage Collectors in Java

The document outlines modern garbage collectors in Java, including G1, ZGC, Shenandoah, and Epsilon, highlighting their features and use cases. G1 is designed for low-pause, large heaps, while ZGC and Shenandoah focus on low-latency and concurrent operations. Epsilon serves as a no-op garbage collector for testing purposes, with a comparison of classic and new collectors provided.

Uploaded by

splusmm24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views2 pages

Modern Garbage Collectors in Java

The document outlines modern garbage collectors in Java, including G1, ZGC, Shenandoah, and Epsilon, highlighting their features and use cases. G1 is designed for low-pause, large heaps, while ZGC and Shenandoah focus on low-latency and concurrent operations. Epsilon serves as a no-op garbage collector for testing purposes, with a comparison of classic and new collectors provided.

Uploaded by

splusmm24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Modern Garbage Collectors in Java

1. G1 Garbage Collector (Garbage-First)

• Introduced in Java 7 (experimental), default in Java 9+


• Designed for low-pause, large heaps, predictable pause times
• Divides heap into many equal-sized regions instead of fixed Young/Old Gen areas
• Collects the regions with the most garbage first (“garbage first”)
• Supports both parallel and concurrent phases

Key features:

• Mixed GC phases: collects both young and old regions in one GC cycle
• Concurrent marking to reduce pause times
• Predictable pause time goals (-XX:MaxGCPauseMillis)

2. Z Garbage Collector (ZGC)

• Introduced in Java 11 (production-ready in Java 15+)


• A low-latency, scalable, concurrent GC designed for heaps from a few GBs to
multi-terabytes
• Targets pause times <10ms, independent of heap size
• Works mostly concurrently with the application
• Uses colored pointers and load barriers to track references without stopping the
world

Key features:

• Concurrent marking, relocation, and cleanup phases


• Region-based heap layout
• Supports heap sizes up to several terabytes
3. Shenandoah GC

• Developed by Red Hat, integrated into OpenJDK in Java 12+


• Similar goals as ZGC: low-pause concurrent GC
• Uses concurrent compaction to avoid long pauses
• Reduces pause times by performing evacuation (relocation of live objects)
concurrently with application threads

4. Epsilon GC (No-Op GC)

• Introduced in Java 11
• A no-op GC that allocates memory but never collects it
• Useful for performance testing and benchmarking, or workloads where you want to
manage memory yourself or expect the process to restart before GC

🆚 Classic vs New GC Summary


Pause Concurre Default in JVM
Collector Target Use Case Heap Size
Times nt? Version
Small heaps, single-
Serial GC Long Small No Java 8+ (option)
core
Parallel Medium- Java 8 default Young
Throughput focus Moderate No
GC large GC
Medium-
CMS GC Low pause old gen Shorter Yes Deprecated since 14
large
Short Medium-
G1 GC Low pause, large heaps Mostly yes Java 9+ default
(~100ms) large
Ultra-low pause, huge
ZGC <10ms Huge (TBs) Yes Java 15+
heaps
Shenand Low pause concurrent Large
<10ms Yes Java 12+
oah GC heaps
Epsilon
Testing (no collection) None N/A No Java 11+
GC

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy