ubuntutomcat7out-of-memoryopenmrs

Tomcat7 out of memory error even after increasing the heap size


(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?


Solution

  • 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.