Solve Tomcat –java.lang.OutOfMemoryError: PermGen space

Some Times Tomcat may give– java.lang.OutOfMemoryError: PermGen space  error

By default Tomcat is assigned a very little PermGen memory . To fix it, we have to increase the PermGen memory settings by using Java VM options

-XX:PermSize<size> - Set minimum PermGen Size.
-XX:MaxPermSize<size> - Set the maximum PermGen Size.

Solution

1.For Windows create ${tomcat-folder}\bin\setenv.bat file and add below  lines to it.

set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m

2.For Linux create ${tomcat-folder}\bin\setenv.sh file and below lines to it.

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"

Now Restart the server.

Advertisements
This entry was posted in Java, Tomcat. Bookmark the permalink.

One Response to Solve Tomcat –java.lang.OutOfMemoryError: PermGen space

  1. shantan says:

    nice

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s