How can I earlier OOM in excessive GC?

Sometimes my JVM runs out of memory, but instead of OOMing, which I can restore (or heapDumpOnOOM and debug), it tends to thrash in the GC a few hours before erasing it from memory. This is essentially the same as the question (unanswered): How do I set the upper limit of Java GC? But I suspect the answer is that you cannot set the threshold to 98% / 2%, so I ask for any way to achieve this effect. pay attention to excessive GC and possibly cause OOM or kill JVM or such.

+1
source share
1 answer

The Oracle GC Ergonomics Guide describes options for both thresholds. GCTimeLimit and GCHeapFreeLimit . Lowering the former and increasing the latter should cause OOM to start earlier.

+1
source

Source: https://habr.com/ru/post/1201542/


All Articles