title: How JVM -XX:MaxRAM option can be correctly used?
body: <p>I run a java application with the following parameters:</p>
  
  <pre><code>#!/bin/bash
  
  export JVM_OPTS="-XX:MaxRAM=150m"
  export JVM_OPTS="$JVM_OPTS -XX:+UseSerialGC"
  
  java $JVM_OPTS -jar application.jar
  </code></pre>
  
  <p>The <code>htop</code> shows:</p>
  
  <ul>
  <li>VIRT=475M</li>
  <li>RES=238M</li>
  <li>SHR=4880</li>
  <li>MEM%=24.1</li>
  </ul>
  
  <p>As I understand it, I need to look at the <code>RES</code> parameter. But in this case, it greatly exceeds <code>-XX:MaxRAM</code>. Expected that in this case, <code>OutOfMemoryException</code> 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?</p>
  
  <p>I want to minimize the used RAM. OS - ​​CentOS 7</p>