Profile Image
vishnupriya

What is JVM startup parameter: -XX:+UseConcMarkSweepGC?

What is JVM startup parameter: -XX:+UseConcMarkSweepGC? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-useconcmarksweepgc

  • x-useconcmarksweepgc

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

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:

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-useconcmarksweepgc

  • x-useconcmarksweepgc

  • JVM startup parameter