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


- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01