JVM Application OOMs on Fly but not in similar conditions on local machine

Maybe try specifying max memory (-XX) in absolute GB—instead of as a percentage.

In the past, people have reported nuances with how JVM-like language runtimes determine the machine’s total available memory (due to cgroups).

[.net 5/6 app killed because of memory usage; no cgroup limit being the reason?]