title: Java out of memory error when memory is in fact available
body: <p>I keep running into OOM errors and subsequent JBoss  crashes, even though the heap shows that all of the memory allocated to it isn't used up.</p>
  
  <p>For eg: If I have 1200MB allocated as the heap size (Xmx), crashes occur well below that limit with none of the individual generations in the heap (young / old / perm) at a 100%.</p>
  
  <p>The box has plenty of RAM. Why might java be reporting this error when its really not out of memory?</p>
  
  <pre><code> Heap
  
   PSYoungGen      total 67456K, used 9525K [0x57540000, 0x5c170000, 0x5fa90000)
    eden space 66432K, 12% used [0x57540000,0x57d91520,0x5b620000)
    from space 1024K, 98% used [0x5c070000,0x5c16c198,0x5c170000)
    to   space 3008K, 0% used [0x5bb90000,0x5bb90000,0x5be80000)
  
   PSOldGen        total 466048K, used 313530K [0x14a90000, 0x311b0000, 0x57540000)
    object space 466048K, 67% used [0x14a90000,0x27cbea38,0x311b0000)
  
   PSPermGen       total 226432K, used 141461K [0x04a90000, 0x127b0000, 0x14a90000)
    object space 226432K, 62% used [0x04a90000,0x0d4b55e8,0x127b0000)
  </code></pre>