title: How to detect Out Of Memory condition?
body: <p>I have an application running on Websphere Application Server 6.0 and it crashes nearly every day because of Out-Of-Memory. From verbose GC is certain there are the memory leaks(many of them) </p>
  
  <p>Unfortunately the application is provided by external vendor and getting things fixed is slow &amp; painful process. As part of the process I need to gather the logs and heapdumps each time the OOM occurs.</p>
  
  <p>Now I'm looking for some way how to automate it. Fundamental problem is how to detect OOM condition. One way would be to create shell script which will periodically search for new heapdumps. This approach seems me a kinda dirty. Another approach might be to leverage the JMX somehow. But I have little or no experience in this area and don't have much idea how to do it.</p>
  
  <p>Or is in WAS some kind of trigger/hooks for this? Thank you very much for every advice! </p>