title: Does G1GC release back memory to the OS even if Xms = Xmx?
body: <p>After reading some answers like <a href="https://stackoverflow.com/a/30464183/1432247">this</a> and <a href="https://openjdk.java.net/jeps/346" rel="noreferrer">JEP-346</a>, I have realised that the G1 does release memory back to the OS.</p>
  
  <p>However does it release memory back to the OS, even to the point that current memory use can drop below the initial heap memory (i.e before this JEP, in my case JDK11)?</p>
  
  <p>Assume I have a Java 11 VM running with <code>Xms</code> and <code>Xmx</code> set as <code>5GB</code>, on a <code>8GB</code> RAM, however I am consuming only around <code>1GB</code>. Will G1 release enough memory back to the OS?</p>
  
  <p>I didn't find any documentation anywhere which says that the G1 is restricted to releasing keeping the <code>Xms</code> threshold in mind. </p>
  
  <p>I am observing this in Production, the MemAvailable keeps on decreasing till a point, and then after a GC, it jumps upto close to 30-35% on an 8GB box. So I am assuming it is releasing memory, which is why the MemAvailable is jumping back up.</p>
  
  <p>Also what does it exactly mean to release memory to the OS, is it calling free/unmap ?</p>