linux centos 下报错Exception in thread "http-bio-8080-exec-18" java.lang.OutOfMemoryError: PermGen space
错误信息:
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-7" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-8" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-13" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-14" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-15" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-16" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-17" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-18" java.lang.OutOfMemoryError: PermGen space
Exception in thread "DispatcherThread" java.lang.OutOfMemoryError: PermGen space
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "State Saver" java.lang.OutOfMemoryError: PermGen space
Exception in thread "AWT-Windows" java.lang.OutOfMemoryError: OutOfMemoryError
错误原因:
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域,这块内存主要是被JVM存放Class和Meta信息的,Class在被Loader时就会被放到PermGen space中,它和存放类实例(Instance)的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的应用中有很多CLASS的话,就很可能出现PermGen space错误,这种错误常见在web服务器对JSP进行pre compile的时候。如果你的WEB APP下都用了大量的第三方jar, 其大小超过了jvm默认的大小(4M)那么就会产生此错误信息了。
catalina.sh 的第236行
# Uncomment the following line to make the umask available when using the
# org.apache.catalina.security.SecurityListener
#JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"
#=============此部分是增加的代码==============
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m
-Xmx1024m -XX:NewSize=512m -XX:MaxNewSize=256m -XX:PermSize=512m
-XX:MaxPermSize=512m -XX:+DisableExplicitGC"
#=============此部分是增加的代码==============
# —– Execute The Requested Command —————————————–
具体参考:http://www.cnblogs.com/xwdreamer/archive/2011/11/21/2296930.html