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

‑Xenableexcessivegc / ‑Xdisableexcessivegc

Enables or disables the throwing of an OutOfMemory exception if excessive time is spent in the GC.

If excessive time is spent in the GC, the option returns null for an allocate request and thus causes an OutOfMemory exception to be thrown.

Note: The OutOfMemory exception is thrown only when the heap has been fully expanded and the percentage of application run time that is not spent in garbage collection is at least 95%. This percentage is the default value that triggers an excessive GC event. You can control this value with the -Xgc:excessiveGCratio option.


Setting Effect Default
-Xenableexcessivegc Enable exception yes
-Xdisableexcessivegc Disable exception