JEP drafts – removing Concurrent Mark Sweep garbage collector & ZGC support for macOS
Two new JDK Enhancement Proposals, or JEP, drafts propose to make changes to garbage collection in the next JDK. One wants to remove Concurrent Mark Sweep garbage collector, since it was deprecated two years ago, and the other wants to make Z Garbage Collector available to macOS users as well. Let’s take a closer look.
So long, Concurrent Mark Sweep Garbage Collector
It is not yet an official JEP, but Thomas Schatzl has already put forward a draft proposing the Concurrent Mark Sweep (CMS) Garbage Collector be removed. This is no great surprise, as it was already deprecated in Java 9 (JEP 291). According to Schatzl, interested users had two years to step up and take care of the project. Since no one came forward, he proposes it’s time to give Mark Sweep its last rites before sending it on its way.
However, users of older Java versions who rely on the CMS GC can breathe a sigh of relief – the goal is not to remove the garbage collector from earlier JDK releases. The same is true for other garbage collectors like Shenendoah or ZGC, even though this should go without saying. These remain in the JDK and have nothing to do with the new JEP draft.
In the draft Schatzl justified his suggestion further by pointing out that “in the meantime the Oracle garbage collection team introduced a new garbage collector, ZGC, and Red Hat contributed the Shenandoah collector. Oracle further improved G1, which has been its designated successor since initial introduction in JDK6u14. So we believe that the available garbage collection algorithms provided by the Hotspot VM, if they do not surpass CMS’ performance, have a small enough overhead even for applications that are highly tuned to CMS to be able to move away from it today.”
Since he expects the above-mentioned alternative garbage collectors to undergo constant improvement, he expects that they will soon be outperforming the deprecated CMS GC in a way that softens its departure further.
ZGC support for macOS
Speaking of ZGC, or Z Garbage Collector, another JEP draft dealing with garbage collection was created by Erik Österlund. The goal of this proposal is to make the Z Garbage Collector available as an option for macOS users as well. Part of the JEP is also for it to be the functionality of the collector to free up unused memory for the system, as suggested in JEP 351. This functionality is likely to be included in Java 13.