Did you ZGC that coming?

JEP 377: Promote ZGC from experimental garbage collector to production feature

Chris Stewart
© Shutterstock / WAYHOME studio

Z Garbage Collector has been part of the JDK since Java 11. Since then lots of new features and enhancements have been made to ZGC, resulting in a long time as an experimental feature. However, because no ZGC-specific bugs have been reported in months, JEP 377 proposes to change its status from experimental to production.

With the release of Java 11 in September 2018, Z Garbage Collector was integrated into the JDK as an experimental feature. Now, with the upcoming release of Java 15 two years later, JEP owner Per Liden proposes to make ZGC a production feature.

JEP 377: Make ZGC a production feature

In JEP 377, Per Linden writes, “With the stability, feature set, and platform support that ZGC has today, it is time to remove its experimental status and make it a product feature.”

JEP 333 integrated Z Garbage Collector into the Java Development Kit. Since then, ZGC has received a number of bug fixes, features and enhancements. These include concurrent class unloading, uncommitting unused memory (JEP 351), increasing the max heap size from 4TB to 16TB and decreasing the minimum heap size to 8MB. Further important highlights are -XX:SoftMaxHeapSize, support for the JFR leak profiler, support for class-data sharing, limited and discontiguous address spaces, support for placing the heap on NVRAM, improved NUMA awareness, and multi-threaded heap pre-touching.

Additionally, ZGC now supports the most common platforms: Linux/x86_64 (added alongside ZGC in JDK 11), Linux/aarch64 (added in JDK 12), and Windows and macOS (added most recently in JDK 14).

With all of this in mind, Linden says, it’s time to make ZGC a production feature of the JDK.

SEE ALSO: Java 15 news and updates

JEP 377: Bringing an experimental Java feature into production

As an experimental feature, ZGC must be enabled using the -XX:+UnlockExperimentalVMOptions option. Changing ZGC to a production feature will remove this step, allowing the UseZGC command to be used without enabling experimental features. In addition, the following ZGC-specific options would also be changed from experimental to product:

  • ZAllocationSpikeTolerance
  • ZCollectionInterval
  • ZFragmentationLimit
  • ZMarkStackSpaceLimit
  • ZProactive
  • ZUncommit
  • ZUncommitDelay

Other necessary changes include the ZGC-specific Java Flight Recorder event ZPageAllocation, which needs to be changed from experimental to product, and some tests will have to be adjusted. This is because they currently use the UnlockExperimentalVMOptions command-line option when enabling ZGC, and it will no longer be necessary once the garbage collector is a product feature.

SEE ALSO: Michael Vitz on Java 14 – “NullPointerExceptions are a significant improvement”

At the time of writing, JEP 377 is proposed to target JDK 15. Read JEP 377 here or take a look at the garbage collector development discussions happening in the mailing list.

Chris Stewart
Chris Stewart is an Online Editor for He studied French at Somerville College, Oxford before moving to Germany in 2011. He speaks too many languages, writes a blog, and dabbles in card tricks.

Inline Feedbacks
View all comments