I run a java application with the following parameters:
#!/bin/bash
export JVM_OPTS="-XX:MaxRAM=150m"
export JVM_OPTS="$JVM_OPTS -XX:+UseSerialGC"
java $JVM_OPTS -jar application.jar
The htop
shows:
- VIRT=475M
- RES=238M
- SHR=4880
- MEM%=24.1
As I understand it, I need to look at the RES
parameter. But in this case, it greatly exceeds -XX:MaxRAM
. Expected that in this case, OutOfMemoryException
will happen. What am I doing wrong? How to limit the memory of a java application for a container? Am I incorrectly looking at the used process memory?
I want to minimize the used RAM. OS - CentOS 7