-XX:[+|-]UseNoGC

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.

Syntax

    -XX:[+|-]UseNoGC
Setting Effect Default
-XX:+UseNoGC Enable
-XX:-UseNoGC Disable yes

Explanation

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. This policy can also be enabled with the -Xgcpolicy:nogc option.

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