title: JVM behaviour when OS runs out of memory
body: <p>I am wondering what's the JVM behaviour for the following situation:</p>
  
  <ul>
  <li>JVM minimum heap size = 500MB</li>
  <li>JVM maximum heap size = 2GB</li>
  <li>OS has 1GB memory</li>
  </ul>
  
  <p>After the JVM started and the program runs for a period of time, it uses more than 1GB memory. I wonder if OOM will happen immediately or it will try to GC first! </p>