I\'m running a containerized java application in Kubernetes.
In order to make the jvm reserve memory according to the container specifications, the flags -XX:+
The -Xmx flag overwrites the -XX:+UseCGroupMemoryLimitForHeap flag.
The flag -XX:+UseCGroupMemoryLimitForHeap lets the JVM detect what the max heap size in a container should be.
The -Xmx flag set the max heap size to a fixed size.
To answer your example, the JVM would reserve 2500M heap space. There will be some additional memory usage for non-heap and jvm stuff.
To further tune your memory usage in a container you could use the -XX:MaxRAMFraction flag. See this article: https://blog.csanchez.org/2017/05/31/running-a-jvm-in-a-container-without-getting-killed/