Skip to content

-Xclassgc / -Xnoclassgc

Enables and disables the garbage collection (GC) of storage that is associated with Java classes that are no longer being used by the 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.

Syntax

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