Skip to content

-Xclassgc / -Xnoclassgc

Enables and disables class garbage collection (the dynamic unloading of class objects by the VM).

When enabled, garbage collection, occurs only on class loader changes. This is the default behavior.

Note: Disabling class garbage collection is not recommended as this causes unlimited native memory growth, leading to out-of-memory errors.


Setting Action Default
-Xclassgc Enable GC yes
-Xnoclassgc Disable GC