Adjusting GC Overhead Exceeded parameters

▼魔方 西西 提交于 2019-12-17 20:51:39

问题


I need my Oracle Hotspot to throw an exception java.lang.OutOfMemoryError: GC overhead limit exceeded much sooner than with the default parameters of UseGCOverheadLimit.

By default, OOME occurs when more than 98% of the time is spent in GC and less than 2% of the heap is recovered (described http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.oom).

For instance, I need my JVM to throw OOME when more than 20% of the time is spent in GC. Unfortunately, the -XX:GCTimeRatio=nn doesn't seem to make a difference.

The reason I need to adjust my JVM in this way is that I'm testing my application whether it contains a memory leak (precisely, I have a memory leak detection infrastructure where I want to test our app on a daily basis) and I don't need my JVM to try as hard as possible to free the heap.


回答1:


By default, OOME occurs when more than 98% of the time is spent in GC and less than 2% of the heap is recovered

These two values are configured via GCHeapFreeLimit and GCTimeLimit

GCTimeRatio only defines a soft goal for which the GC heuristics will optimize.



来源:https://stackoverflow.com/questions/32395110/adjusting-gc-overhead-exceeded-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!