Adjusting GC Overhead Exceeded parameters(调整 GC Overhead Exceeded 参数)
问题描述
我需要我的 Oracle Hotspot 比使用 UseGCOverheadLimit 的默认参数更快地抛出异常 java.lang.OutOfMemoryError: 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.
默认情况下,OOME 发生在 98% 以上的时间用于 GC 且堆回收不到 2% 时(描述 http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.oom).
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).
例如,当超过 20% 的时间用于 GC 时,我需要我的 JVM 抛出 OOME.不幸的是,-XX:GCTimeRatio=nn 似乎没有什么不同.
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.
我需要以这种方式调整我的 JVM 的原因是我正在测试我的应用程序是否包含内存泄漏(准确地说,我有一个内存泄漏检测基础设施,我想每天测试我们的应用程序)而且我不需要我的 JVM 尽可能努力地释放堆.
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.
推荐答案
默认情况下,当超过 98% 的时间花费在 GC 上且不到 2% 的堆被回收时,就会发生 OOME
By default, OOME occurs when more than 98% of the time is spent in GC and less than 2% of the heap is recovered
这两个值是通过GCHeapFreeLimit和GCTimeLimit
GCTimeRatio 仅定义了 GC 启发式算法将优化的软目标.
GCTimeRatio only defines a soft goal for which the GC heuristics will optimize.
这篇关于调整 GC Overhead Exceeded 参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:调整 GC Overhead Exceeded 参数
基础教程推荐
- 从 python 访问 JVM 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
