问题描述
有时候,我的JVM耗尽内存,而不是OOMing,我可以从中恢复(或堆dumpOnOOM和调试),它往往会在内存溢出之前在GC中出现几个小时的颠簸。这与(未回答)问题基本相同:
但我怀疑答案是您无法调整98%/ 2%的阈值,所以我想要以任何方式实现类似影响。注意过多的GC,最好是导致OOM,或者杀死JVM等。 解决方案
Oracle的涵盖了这两个阈值的选项。 GCTimeLimit
和 GCHeapFreeLimit
。降低前者和增加后者应该会导致OOMs更快发生。
Occasionally my JVM runs out of memory, but rather then OOMing which I can recover from (or heapDumpOnOOM and debug) it tends to thrash in GC for hours before throwing out of memory.This is essentially the same as the (unanswered) question: How can I configure the Java GC Overhead Limit?But I suspect the answer is you can't tune the 98%/2% thresholds, so I'm asking of any way to achieve similar effect. notice excessive GC, and preferably cause OOM, or kill the JVM or such.
Oracle's GC ergonomics guide covers options for both thresholds. GCTimeLimit
and GCHeapFreeLimit
. Lowering the former and increasing the latter should result in OOMs occuring sooner.
这篇关于我如何更快地使用过量的GC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!