title: java G1 gc takes too much of memory
body: <p>For example, I set -Xmx as 40G. I expect my java processor won't use exceed 40G.</p>
  
  <p>My program is working fine with cms-gc. </p>
  
  <p>But when I change to G1 gc with same memory(even 15% more memory).</p>
  
  <p>It always killed by oom killer.</p>
  
  <p>I found some article like this: <a href="https://plumbr.io/blog/memory-leaks/why-does-my-java-process-consume-more-memory-than-xmx" rel="nofollow noreferrer">Why does my Java process consume more memory than Xmx?</a></p>
  
  <p>It express:</p>
  
  <pre><code> G1 is especially known for its 
   excessive appetite for additional memory, so be aware of this.
  </code></pre>
  
  <p>So I want to know, how to limit the memory that g1 gc used and why g1 use so much additional memory</p>