问题描述
我需要我的Oracle Hotspot比的默认参数更快地抛出一个异常
。 java.lang.OutOfMemoryError:超出GC开销限制
UseGCOverheadLimit
默认情况下,OOME在超过98%的时间用于GC时发生,并且不到2%的堆已恢复(如)。
例如,我需要我的JVM当超过20%的时间用于GC时抛出OOME。
不幸的是, -XX:GCTimeRatio = nn
似乎没有什么区别。
我需要以这种方式调整我的JVM的原因是我正在测试我的应用程序是否包含内存泄漏(具体而言,我有一个内存泄漏检测基础结构,我想每天测试我们的应用程序),而且我不不需要我的JVM尽可能的努力来释放堆。
这两个值是通过 GCHeapFreeLimit
和 GCTimeLimit
GCTimeRatio
只定义了GC启发式将优化的软目标。
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.
These two values are configured via GCHeapFreeLimit
and GCTimeLimit
GCTimeRatio
only defines a soft goal for which the GC heuristics will optimize.
这篇关于调整GC开销超出的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!