Knowledgebase article 3

Allocate more RAM to Tomcat (For "PermGen" or "Java Heap Space" errors)


This article contains information about how to set up the JAVA_OPTS variables to increase the memory available for Tomcat to use. These variables do not always have to be set, but by setting them correctly, it may resolve many reporting issues and errors.

This generally fixes error keywords: “PermGen” or “JavaHeap"
 
In Java 8 (eHD v 11.4) the PermSize and MaxPermSize JVM arguments are ignored and a warning is issued if present at start-upInstead, replace with MetaspaceSize & MaxMetaspaceSize.

By default class metadata allocation is only limited by the amount of available native memory. Use the new flag MaxMetaspaceSize to limit the amount of  native memory used for class metadata. It is analogous to MaxPermSize.

For additional instructions (that usually contain images), see the attached document.

Note: For v11 and newer, edit the file wrapper.conf located in tomcat/conf directory.  Modify the following java parameter:

-XX:PermSize=1024m
-XX:MaxPermSize=1024m

Increase the Initial Java Heap Size and Maximum Java Heap Size.  Usually 512M will work, but you can increase to 1024M.

Restart the tomcat service.


Follow instructions below for v10 and older
Windows:

1. Run (as administrator) the "Configure Tomcat" application.  (GLtomcat6w.exe located in the tomcat directory root\bin\).

2. Click on the Java tab.

3. Under Java Options, add the following lines (to the bottom of possibly many already existing lines):

-XX:PermSize=512m
-XX:MaxPermSize=512m

Note: These are case sensitive and be very careful not to include any additional spaces.  You may also wish to try 1024m in these values.

4. Click the "general" tab and restart the tomcat service by clicking the command buttons under "Service Status."

5. Click OK to close the application.

Linux:

1. Find and edit the catalina.sh file.  (usually located in /usr/share/tomcat6/bin).

2. Inside catalina.sh, find the JAVA_OPTS variable (usually at the bottom of the comments section).

3. Edit the JAVA_OPTS variable to be:

JAVA_OPTS='-Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m -Djava.awt.headless=true'

Note: This is case sensitive and be very careful not to include any additional spaces.

4. Exit the editor and restart the tomcat service.


Memory
Group eHD Standard Support Last modified May 5, 2023 Type Public Viewed 7887