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 参数


基础教程推荐
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 降序排序:Java Map 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01