‑Xenableexplicitgc / ‑Xdisableexplicitgc
Enables and disables garbage collection (GC) when calls are made to System.gc()
.
Syntax
Setting | Effect | Default |
---|---|---|
-Xenableexplicitgc |
Enable GC | yes |
-Xdisableexplicitgc |
Disable GC |
Explanation
Although it is possible to programmatically trigger a garbage collection 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 garage collection cycle.