How to Replace the Deprecated CMS GC in JDK 9?

This article explains why the CMS garbage collector was removed in JDK 9, shows the deprecation warning, and evaluates three migration paths—switching to G1 GC, adopting ZGC, or continuing with CMS—helping developers choose the best option for their applications.

Programmer DD
Programmer DD
Programmer DD
How to Replace the Deprecated CMS GC in JDK 9?

In JDK 9 the Concurrent Mark Sweep (CMS) garbage collector was deprecated, as described in JEP‑291, to reduce maintenance complexity and accelerate new GC features.

If you start an application with the -XX:+UseConcMarkSweepGC flag, the JVM prints the following warning:

Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

Why was CMS GC deprecated?

CMS is a highly configurable and complex algorithm, which adds significant code complexity to the JDK’s GC subsystem. Simplifying the GC codebase allows the JDK team to innovate faster. The table below shows that CMS has 72 extra JVM options, far more than any other collector.

CMS vs other GC parameters table
CMS vs other GC parameters table

What to do if you are using CMS?

There are three main options:

Switch to the G1 GC algorithm, which became the default in Java 9 and generally offers better performance with fewer tuning parameters.

Switch to ZGC (available in early versions of JDK 11 and 12), a low‑latency collector targeting pause times under 10 ms.

Continue using CMS, which can still outperform G1 for certain workloads after careful tuning; the community even debates keeping CMS available.

Conclusion

Each application is unique, so thorough testing and benchmarking of any new GC configuration are essential before making a decision.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaGarbage CollectionzgcJDK9g1-gcCMS GC
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.