Search code examples
javagarbage-collectionjvmjvm-hotspotg1gc

Is UseGCOverheadLimit supported with G1 GC?


In HotSpot JVM GC Tuning Guide the UseGCOverheadLimit option is mentioned only on the pages about CMS and Parallel GCs. Additionally, on GC Ergonomics doc page the related options GCTimeLimit and GCHeapFreeLimit are mentioned like if they work only with Parallel 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 [...]

Are those options supported with -XX:+UseG1GC?


Solution

  • GC overhead limit is the feature of AdaptiveSizePolicy, which is used in Parallel GC and CMS, but not in G1.

    You may also double-check that gc_overhead_limit_was_exceeded flag is never set in G1CollectedHeap::mem_allocate.

    So, -XX:+UseGCOverheadLimit does nothing in G1 GC.