Generational ZGC
Generational ZGC is added in Java 21 (JEP 439).
ZGC was ready for production use since JDK 15 (JEP 377). ZGC is a scalable low-latency garbage collector. Generational ZGC can improve application performance by extending ZGC to maintain separate generations for young and old objects. Young objects will be collected more frequently.
To enable Generational ZGC, the -XX:+ZGenerational option should be used together with -XX:+UseZGC option. Using only the -XX:+UseZGC option will select non-generational ZGC.
1 $ java -XX:+UseZGC -XX:+ZGenerational
In Java 23,Generational ZGC become the default option (JEP 474). The non-generational mode is deprecated and will be removed in a future release. Use the -XX:-ZGenerational option to select non-generational ZGC.