Profile Image
vishnupriya

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

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

  • jvmargument

  • xx-explicitgcinvokesconcurrent

  • x-explicitgcinvokesconcurrent

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:                                                    

 

The option “-XX:+ExplicitGCInvokesConcurrent” enables invoking of concurrent Garbage Collector (GC) by using the “System.gc()” request.

 

Since:

 

Starting from JDK 6.

 

Syntax:

 

java -XX:+ExplicitGCInvokesConcurrent MainClass

 

Description:

 

Before talking about the flag, we need to introduce Garbage Collector (GC):

 

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

 

CMS Garbage Collector, as mentioned above, is one of the implementations of GC, which uses multiple thread for garbage collection. It’s created for applications that favor shorter garbage collection pauses and that can afford to share processor resources with the garbage collector while the application is running. It achieves long pauses by two ways:

 

  • By using free lists to manage reclaimed space instead of compacting the Old Generation.
  • By doing mainly the job in Mark (marking a reference) and Sweep (removing the marked reference) process simultaneously with the application. Which means that the GC is not stopping or freezing the application’s threads to do its job. But it does take part of using the CPU time with the application. By default, GC algorithm can use number of threads up to ¼ of the number of physical cores of your machine.

 

The flag “-XX:+ExplicitGCInvokesConcurrent” instructs the JVM to run a Concurrent Mark Sweep (CMS) Garbage Collector (GC) instead of a full GC whenever system GC is requested.

 

Default Value:

 

This option is disabled by default and can be enabled only together with the “-XX:+UseConcMarkSweepGC” and “-XX:+UseG1GC” options.

 

Errors:

 

None.

 

Arguments related:

 

ExplicitGCInvokesConcurrentAndUnloadsClasses.

 

Related Posts:

 

Got something else on mind? Post Your Question

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

  • xx-explicitgcinvokesconcurrent

  • x-explicitgcinvokesconcurrent

  • JVM startup parameter