ZGC generational mode by default

Java 23 Course · lesson 8 of 15 · 3 min read

The flag flip that made the better ZGC the one you actually get.

Open this lesson in the learning hub

Key points

  • Java 21 added generational ZGC but left it behind -XX:+ZGenerational.
  • Most teams never flip an opt-in flag, so most ZGC users were running the slower mode.
  • JEP 474 made generational the default in 23, with the non-generational mode deprecated.
  • If you set -XX:+ZGenerational explicitly you can now drop it - it is the default.
  • Non-generational ZGC was removed entirely in a later release, so scripts pinning it will fail.

The important change was not the algorithm but the default - opt-in performance rarely gets adopted.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Java 23 Course course, and every lesson in it is listed on the Java 23 Course contents page.