Skip to content

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


The -XX:+UseNoGC option enables a garbage collection policy that expands the Java object heap in the normal way until the limit is reached, but memory is not reclaimed through garbage collection.


Setting Effect Default
-XX:+UseNoGC Enable
-XX:-UseNoGC Disable yes


This policy can be useful for test purposes and for short-lived applications. When the limit is reached an OutOfMemory error is generated and the VM shuts down.

The -XX:-UseNoGC option turns off a previously enabled -XX:+UseNoGC option.

This policy can also be enabled with the -Xgcpolicy:nogc option. See -Xgcpolicy:nogc for more details about this policy and when it is appropriate to use it.