Profile Image
vishnupriya

What is Disable Class Garbage Collection: -Xnoclassgc?

What is Disable Class Garbage Collection: -Xnoclassgc? 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?

  • jvm-argument

  • xnoclassgc

  • noclassgc

  • Disable Class Garbage Collection

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:


• -Xnoclassgc


Description:


The -Xnoclassgc option disables garbage collection of class objects, i.e. classes
loaded with the ClassLoader.defineClass() method. This means that classes
themselves, and the class loaders that defined them, are always considered “live”
and therefore the memory they occupy is never freed.


Using this option can save some garbage collection time, potentially enhancing
the performance of an application and reducing the overall time taken by batch
programs.


However this option can result in more memory being permanently used, which
can eventually throw an OutOfMemoryError. This is more likely to happen in
which classes are occasionally loaded and unloaded, for example:


• An enterprise application server such as IBM WebSphere;
• A web application container such as Apache Tomcat;
• Any application that can load and unloads plugins at runtime such as
Eclipse IDE (or applications built on the Eclipse Platform such as Lotus
Notes);
• An OSGi-based service platform.
Applications such as these should avoid using -Xnoclassgc.


Default Value:
-Xnoclassgc is off by default, i.e. classes and classloaders are garbage collected
when no longer reachable.


Errors:


None.


Arguments Related to -Xnoclassgc:


TODO: link to -Xms TODO: link to -Xmx


Related Posts:


• To learn about different memory regions in the Java Virtual Machine, see
this video clip.

 

NOTE:


If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xnoclassgc

  • noclassgc

  • Disable Class Garbage Collection