Usage:
The option “-XX:+UseConcMarkSweepGC” activate the Concurrent Mark Sweep (CMS) garbage collector for the old generation.
Since:
Starting from JDK 6.
Deprecated:
- Obsoleted in JDK14
- Expired in JDK15.
Syntax:
java -XX:+UseConcMarkSweepGC MainClass
Examples:
To turn on the CMS garbage collector: java -XX:+UseConcMarkSweepGC MainClass
Description:
Before talking about the flag, we need to introduce Garbage Collector (GC), Young and Old Generations:
Garbage Collector is a way of the JVM to clean the memory and makes the java memory more efficient. It tracks (Mark step) and removes (sweep step) every unused object available in the JVM heap space. An object is considered unused when it’s referenced by null, assigned to another reference or by anonymous object …. There are 5 type of GC implementations:
- Serial Garbage Collector
- Parallel Garbage Collector
- CMS Garbage Collector
- G1 Garbage Collector
- Z Garbage Collector
Old Generation is a place where objects that lived for a long time lie. If an object reaches an age threshold after surviving multiple GC events in the Young Generation, the object gets moved to the Old Generation.
This flag “UseConcMarkSweepGC” enables/disables the use of the Concurrent Mark Sweep (CMS) garbage collector for the old generation. CMS is an alternative to the default garbage collector (G1), which also focuses on meeting application latency requirements. By default, this option is disabled and the collector is selected automatically based on the configuration of the machine and type of the JVM. In JDK 9, the CMS garbage collector is deprecated.
Default Value:
This option is disabled by default.
Errors
None.
Related Posts:
Edit your Comment