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
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
• An OSGi-based service platform.
Applications such as these should avoid using -Xnoclassgc.
-Xnoclassgc is off by default, i.e. classes and classloaders are garbage collected
when no longer reachable.
Arguments Related to -Xnoclassgc:
TODO: link to -Xms TODO: link to -Xmx
• To learn about different memory regions in the Java Virtual Machine, see
this video clip.
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.
Edit your Comment