Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you keep getting <code>OutOfMemoryError</code> no matter how much you increase the max heap, then your application probably has a memory leak, which you must solve by getting into the code and optimizing it. Short of that, you have no other choice but keep increasing the max heap until you can.</p> <p>You can look for memory leaks and optimize using completely free tools like this:</p> <ol> <li><p>Create a heap dump of your application when it uses a lot of memory, but before it would crash, using <code>jmap</code> that is part of the <code>Java</code> installation used by your <code>JVM</code> container (= tomcat in your case):</p> <pre><code># if your process id is 1234 jmap -dump:format=b,file=/var/tmp/dump.hprof 1234 </code></pre></li> <li><p>Open the heap dump using the <a href="http://www.eclipse.org/mat/" rel="nofollow">Eclipse Memory Analyzer (MAT)</a></p></li> <li><p>MAT gives suggestions about potential memory leaks. Try to follow those.</p></li> <li><p>Look at the <strong>histogram</strong> tab. It shows all the objects that were in memory at the time of the dump, grouped by their class. You can order by memory use and number of objects. When you have a memory leak, usually there are shockingly too many instances of some objects that clearly don't make sense all. I often tracked down memory leaks based on that info alone.</p></li> </ol> <p>Another useful free <code>JVM</code> monitoring tool is <a href="http://visualvm.java.net/" rel="nofollow">VisualVM</a>. A non-free but very powerful tool is <a href="http://www.ej-technologies.com/products/jprofiler/overview.html" rel="nofollow">JProfiler</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload