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 参数
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
