Skip to content

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

‑Xcompactexplicitgc / ‑Xnocompactexplicitgc

Enables or disables full compaction each time System.gc() is called.

Compaction takes place on global garbage collections if you specify -Xcompactgc or if compaction triggers are met.


Setting Action Default
-Xcompactexplicitgc Enable compaction yes
-Xnocompactexplicitgc Disable compaction

See also