
- Java 13 Tutorial
- Java 13 - Home
- Java 13 - Overview
- Java 13 - Environment Setup
- Java 13 Language Changes
- Java 13 - Switch Expressions
- Java 13 - Text Blocks
- Java 13 - Text Block Methods
- Java 13 - Socket API Reimplementation
- Java 13 - Miscellaneous Changes
- Java 13 JVM Changes
- Java 13 - Dynamic CDS Archive
- Java 13 - ZGC Enhancements
- Java Other Versions Tutorials
- Java Tutorial
- Java 8 Tutorial
- Java 9 Tutorial
- Java 10 Tutorial
- Java 11 Tutorial
- Java 12 Tutorial
- Java 13 Useful Resources
- Java 13 - Quick Guide
- Java 13 - Useful Resources
- Java 13 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java 13 - ZGC Enhancements
The ZGC or Z Garbage Collector was introduced with Java 11 as a low latency garbage collection mechnism. ZGC makes sure that Garbage Collection pause time is not dependent on heap size. It will never exceed 10 ms no matter heap size is 2MB or 2GB.
But ZGC had a limitation on returning unused heap memory to operating system like other HotSpot VM GCs such as G1 and Shenandoah. Following are the enhancements done with Java 13:
ZGC returns uncommited memory to operating system by default until the maximum heap size is reached.
ZGC gives performance improvement with a reduced memory footprint.
ZGC now supports heap size of 16 TB as compared to 4TB size limit.
In order to move back to Java 11 way of Garbage Collection, we can use following options:
using -XX:-ZUncommit option
set -Xms and -Xmx heap size as same.