title: How to detect the cause of OutofMemoryError?
body: <p>I have a complaint that a server application of mine is crashing on high load.<br>
  It is a web app running in <code>Tomcat 5</code>.<br>
  I see the thread dumps and I see that there is an OutOfMemory error  </p>
  
  <blockquote>
    <p>1TISIGINFO     Dump Event "systhrow" (00040000) Detail<br>
    "java/lang/OutOfMemoryError" "Failed to create thread: retVal -1073741830, errno 12"   >received  1TIDATETIME    Date:                 2012/07/17 at 20:03:17 1TIFILENAME   >Javacore filename:C:\ServerApplication\Tomcat5\bin\javacore.34545719.4646464.4172.0003.txt    </p>
  </blockquote>
  
  <p>The heap information is the following:  </p>
  
  <pre><code>Maximum Java heap size : 1500m    
  Initial Java heap size : 256m
  </code></pre>
  
  <p>This is the configuration for initial and Max heap size (32 bit java)  </p>
  
  <p>I also see that there is available free heap space  </p>
  
  <pre><code>1STHEAPFREE    Bytes of Heap Space Free: 2D19F3C0   
  1STHEAPALLOC   Bytes of Heap Space Allocated: 5DC00000
  </code></pre>
  
  <p>This is arround 750MB free space, right?  </p>
  
  <p>And from the thread method analysis I see that the number of Threads is <code>695</code> of which <code>49%</code> is <code>java/lang/Object.wait(Native Method)</code> and <code>39%</code> is in <code>sun/misc/Unsafe.park(Native Method)</code><br>
  Also I see this <code>NO JAVA STACK 1%</code> not sure what that means.<br>
  Also 0 treads deadlocked and <code>2%</code> is Runnable.   </p>
  
  <p>I am not sure how to interpret this information or how to go on from here to detect the underlying cause.<br>
  Any help on this?  </p>