Skip to content

CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit www.eclipse.org/openj9/docs

‑Xenableexplicitgc / ‑Xdisableexplicitgc

The options enable or disable garbage collection (GC) when calls are made to System.gc().

Syntax

Setting Effect Default
-Xenableexplicitgc Enable explicit GC calls yes
-Xdisableexplicitgc Disable explicit GC calls

Explanation

Although it is possible to programmatically trigger a global GC by calling System.gc(), performance can be adversely affected by halting the application before it is really necessary. Use this option to prevent the VM responding to application requests for a GC cycle.

The default for all Eclipse OpenJ9™ GC policies is -Xenableexplicitgc except for -Xgcpolicy:nogc, where the default is -Xdisableexplicitgc.

These options can be used with all OpenJ9 GC policies.