The Concurrent Mark Sweep (CMS) Collector


Introduction

The Concurrent Mark Sweep (CMS) collector is designed for applications that prefer shorter garbage collection pauses, and that can afford to share processor resources with the garbage collector while the application is running.

Applications that have a relatively large set of long-lived data (a large old generation) and run on machines with two or more processors tend to benefit from the use of this collector. The CMS collector is enabled with the command-line option -XX:+UseConcMarkSweepGC.


Deprecation

The CMS collector is deprecated and was removed from the JDK in version 14. Strongly consider using the Garbage-First (G1) collector instead. See JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector for more information.


Further Reading

If you are interested in learning more about how CMS works, see Concurrent Mark Sweep (CMS) Collector in the HotSpot Virtual Machine Garbage Collection Tuning Guide.


Last reviewed on Sat Feb 01 2025 00:00:00 GMT+0000 (Coordinated Universal Time)