PermGen space exception with Maven
- What is PermGen Space?
PermGen Stands for Permanent Generation. PermGen space is a part heap memory.It is used for storing metadata information like class definitions.
- Why this OutOfMemoryError exception occurs?
The OutOfMemoryError: PermGen Space error occurs when the permanent generation heap is full. Usually this error is caused by a memory leak.
- How To Fix this exception ?
a)MAVEN
If your are using maven you get this error create following environment variable:
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"
Here 128m is double of the default space.
Note*: If your using eclipse for running maven command and setting the MAVEN_OPTS is not
solving problem try to run your maven commands using command line,as sometime it does not
works.
solving problem try to run your maven commands using command line,as sometime it does not
works.
b)Tomcat
Open catalina.sh Or catalina.bat based on the OS and change the JAVA_OPTS as follows:
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"
Nice solutions and explanation about permgen space. helped in resolving the issue.
ReplyDeletethanks