Skip to main content

Posts

Showing posts from October, 2013

Fix Tomcat PermGen Space (Out of Memory)

Tomcat production server sometime will hit the following java.la ng.OutOfMemoryException: PermGen space error. java.la ng.OutOfMemoryException: PermGen space     at java.lang.ClassLoader.de fineClass1(Native Method)     at java.lang.ClassLoader.de fineClass(ClassLoader.java:620)     at java.security.SecureClassLoader.de fineClass(SecureClassLoader.java:124)  It’s usually happened when the Tomcat start and stop few times. It’s just funny, however you can fine tune it with some minor changes in the Tomcat configuration setting. By default, Tomcat assigned very little memory for the running process, the solution is actually quite simple. All you need todo are 1) create setenv.sh or setenv.bat (windows) 2) add this line if not already exist (depend on what os you are using)    Linux:      export set JAVA_OPTS="-Xms512m -Xmx2g"    Windows       set JAVA_OPTS="-Xms512m -Xmx2g" 3) Done. Restart Tomcat. Explanation: This error are occurs