Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to fix "out of memory" error ?

By default, Tomcat is installed with memory setting of 256MB whereas the recommended memory for OpenSpecimen is 2GB. This could lead to out of memory error when processing large amount of data. E.g. bulk upload, export, etc.

This document describes the steps to fix this. 

How to check what is the current memory setting?

  1. Open $TOMCAT_HOME/logs/catalina.out file.
  2. Search for the string "-Xmx" 
    It will look like -Xmx2048m if set to 2GB.

How to set memory?

Windows:

  1. Delete the existing Tomcat service with command: SC DEL <name of the tomcat service>. The service name can be checked in the services.
  2. Open $TOMCAT_HOME/bin/service.bat in any text editor.
  3. Search for the string "--JvmMx"
  4. Change the max memory to 2 GB (recommended)
    > Before --JvmMx 256
    >After --JvmMx 2048
  5. Save the file.
  6. Open command prompt
  7. Go to $TOMCAT_HOME/bin
  8. Run the command service.bat install 
  9. Start the Tomcat service.

Linux:

  1. Create a new file setenv.sh inside $TOMCAT_HOME/bin/ directory. Add the below line:
    export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m"
  2. Restart the Tomcat service using command - su service <service_name> restart.
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com