How to Deal With OutOfMemory in tomcat

These errors are rather commonly seen during development phases, and even on production servers. These errors are even more annoying than others, because they do not show any stack trace. The reason for this is that a stack trace would not be of help for these errors. The code that fails with an Out Of Memory will be, in most cases, a “victim” of the problem, and not the problem itself.

Although it is very tempting to blame Tomcat on these errors, the fact is that many of them have their causes in “mistakes” in the webapps.

  • Open catalina.bat or catalina.sh
  • add the below code set CATALINA_OPTS=-Xms256m -Xmx1g -XX:MaxPermSize=256m
  • Save & close the file

These errors are rather commonly seen during development phases, and even on production servers. These errors are even more annoying than others, because they do not show any stack trace. The reason for this is that a stack trace would not be of help for these errors. The code that fails with an Out Of…

Leave a Reply

Your email address will not be published. Required fields are marked *