We have a kubernetes pod going out of memory very frequently, but the heapdump file that gets generated during OOM is only 200 MB while Xmx and Xms are defined at 2400 MB. So it looks like GC is able to clean the objects and bring down the heap when OOM is signalled. If that is the case I am not able to understand why jvm still goes and kills the pod even though heap usage went down after GC (as per the heap dump).
Here are the jvm parameters:
-XX:HeapDumpPath=xxx -Xmx2400m -Xms2400m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -XX:CICompilerCount=4 -XX:MaxGCPauseMillis=1000 -XX:+DisableExplicitGC -XX:ParallelGCThreads=4 -XX:OnOutOfMemoryError=kill -9 %p
I expected that the pod does not get killed since GC is probably able to clean the heap objects