Profile Image
vishnupriya

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

What is JVM startup parameter: -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses? 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-explicitgcinvokesconcurrentandunloadsclasses

  • x-explicitgcinvokesconcurrentandunloadsclasses

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:                                                    

 

The option “-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses” enables invoking of concurrent Garbage Collector (GC) by using the “System.gc()” request and unloading of classes during the concurrent GC cycle.

 

Since:

 

Starting from JDK 6.

 

Syntax:

 

java -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses MainClass

 

Description:

 

Let us talk about Garbage Collector (GC), what is a Garbage Collector?

 

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

 

Before the JVM throws an OutOfMemoryError, it performs a full Garbage Collector cycle. Garbage Collector have the knowledge about the memory of your application also can make a better choice and a proper decision. In case of a memory problem, JVM introduced some many arguments to tune your application, such as choosing which implementation of GC, fixed memory segments, lessen the effect of a full GC caused by the call to “System.gc()” and so on…

 

Hence, the flag “-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses” if one of the those parameters which lessen the effect of a full GC caused by the call to “System.gc()”. It allows to execute a parallel GC and unload the classes during a concurrent GC cycle when calling explicitly GC.

 

Default Value:

 

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

 

Errors:

 

None.

 

Arguments related:

 

ExplicitGCInvokesConcurrent, UseConcMarkSweepGC.

 

Related Posts:

 

Got something else on mind? Post Your Question

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

  • xx-explicitgcinvokesconcurrentandunloadsclasses

  • x-explicitgcinvokesconcurrentandunloadsclasses

  • JVM startup parameter