title: Java process memory check test
body: <p>I tried to see how <code>-Xmx</code> and <code>-Xms</code> parameters impact on my program and check how much memory does my process consume.</p>
  
  <p>I wrote a simple program but am not able to reason out the results. Kindly help.</p>
  
  <pre><code>public static void main( String[] args ) {
          char[] array = new char[69926904];
  }
  </code></pre>
  
  <p>I ran with parameters <strong><code>-Xms5M -Xmx200M</code></strong>. Ideally, since a character takes 2 bytes, it should hold 100M characters before exceeding the memory limit. Even if we say, few space is getting used for <em>pointer</em> and <em>length</em>, I don't know, why it is throwing error after  <strong><em>69926904</em></strong> length.</p>
  
  <p>Thanks.</p>