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.
source share