Tomcat7 out of memory error even after increasing the heap size

913 Views Asked by At

(Not a duplicate, i've searched everywhere) I am using Ubuntu server and Tomcat7 gave a PemGenError out of memory. Then i increased the memory in setenv.sh file using export CATALINA_OPTS="Xms2048M -Xmx2048M". Error disappeared for awhile. But now its appearing again.

  1. I am using Tomcat for OpenMRS.
  2. Pretty sure it doesn't take that much memory.
  3. I am running OpenMRS in my laptop fine without allocating this much memory.

Any solution to this?

2

There are 2 best solutions below

1
piet.t On BEST ANSWER

You have increased the wrong memory pool. When tomcat is out of PermGen-memory increasing the heap won't help. Try -XX:MaxPermSize=128m (default is 64m).

As an alternative think about migrating to Java 8 that does not have the PermGen at all. Instead there's metaspace that (in the default settings) would grow indefinitely as long as your machines memory allows.

2
nioidai On

Set the minimum to 1024M and restart tomcat!