title: Will I encounter java.lang.OutOfMemoryError even with no lack of memory?
body: <p>I was reading <a href="http://java.sys-con.com/node/1229281" rel="noreferrer">Unveiling the java.lang.Out OfMemoryError</a> and I was wondering if I've understood it correctly. Is it true that if the Java VM throws a </p>
  
  <blockquote>
    <p><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/OutOfMemoryError.html" rel="noreferrer"><code>java.lang.OutOfMemoryError</code></a>: Requested array size exceeds VM limit</p>
  </blockquote>
  
  <p>It means that the VM has rejected the creation of an array because it has exceeded a pre-defined limit (exceeded the likes of the VM), and <strong>not</strong> because I have run out of memory in the heap space?</p>
  
  <p>Am I right to say that <code>java.lang.OutOfMemoryError: Requested array size exceeds VM limit</code> does not indicate a lack of memory?</p>
  
  <p>Even if I have <em>unlimited</em> memory <em>everywhere</em>, the Java VM could still throw a <code>java.lang.OutOfMemoryError: Requested array size exceeds VM limit</code> if it doesn't like my request to create an array of <em>n</em> size?</p>