G1 GC 是否支持 UseGCOverheadLimit?

Is UseGCOverheadLimit supported with G1 GC?

HotSpot JVM GC Tuning Guide the UseGCOverheadLimit option is mentioned only on the pages about CMS and Parallel GCs. Additionally, on GC Ergonomics 文档页面中提到了相关选项 GCTimeLimitGCHeapFreeLimit,就像它们仅适用于并行 GC:

The parallel garbage collector (UseParallelGC) throws an out-of-memory exception if an excessive amount of time is being spent collecting a small amount of the heap. To avoid this exception, you can increase the size of the heap. You can also set the parameters -XX:GCTimeLimit=time-limit and -XX:GCHeapFreeLimit=space-limit [...]

-XX:+UseG1GC 是否支持这些选项?

GC 开销限制是 AdaptiveSizePolicy, which is used in Parallel GC and CMS, but not in G1 的特性。

您还可以仔细检查 gc_overhead_limit_was_exceeded 标志从未在 G1CollectedHeap::mem_allocate 中设置。

因此,-XX:+UseGCOverheadLimit 在 G1 GC 中什么都不做。