Heap size negotiation for a JVM running in a container
TIL: the JVM defaults to asking a container for 25% of the available memory for the heap. Override this with -XX:MaxRAMPercentage=80 or similar. Works for any recent JVM (10+).
You’ll know if you’ve got it wrong: “a friend of yours” sees an out of memory exception while the container is showing only 40%-60% memory utilization.
It’s all in the Java 10 release notes.