title: Why Java does not allocate memory as much as what we configure
body: <p>I'm using Java 8 on Centos 6. I set up to run my app with -Xmx4g -Xms4g and configure GC log.</p>
  
  <pre><code>[Full GC (Metadata GC Threshold) [PSYoungGen: 98309K-&gt;0K(1223168K)] [ParOldGen: 212350K-&gt;302185K(2796544K)] 310659K-&gt;302185K(4019712K), [Metaspace: 35090K-&gt;35090K(1081344K)], 0.1157579 secs] [Times: user=0.36 sys=0.02, real=0.12 secs]
  </code></pre>
  
  <p>With above log, why Java does not allocate 4g for heap but only 4019712K
  I'm just a little bit confused</p>