Skip to content

CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit

-Xclassgc / -Xnoclassgc

These options enable or disable the garbage collection (GC) of storage that is associated with Java classes that are no longer being used by the Eclipse OpenJ9™ VM.

When enabled, GC occurs only on class loader changes. To always enable dynamic class unloading regardless of class loader changes, set -Xalwaysclassgc.

Note: Disabling class GC is not recommended because unlimited native memory growth can occur, which can lead to out-of-memory errors.


Setting Action Default
-Xclassgc Enables dynamic class unloading on demand yes
-Xnoclassgc Disables dynamic class unloading

These options can be used with all OpenJ9 GC policies.

See also