Linux tomcat解决内存溢出

tomcat 日志报错:

iZ284dfbxn8Z:/usr/local/apache-tomcat-7.0.67/logs # tail -f catalina.out

Exception in thread "http-bio-8080-exec-46" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-47" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-48" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-49" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-50" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-41" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-51" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-52" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-53" java.lang.OutOfMemoryError: PermGen space

Exception in thread "http-bio-8080-exec-55" java.lang.OutOfMemoryError: PermGen space



Tomcat的JVM内存溢出解决方法
在生产环境中,tomcat内存设置不好很容易出现JVM内存溢,解决方法就是修改Tomcat中的catalina.sh文件。

在catalina.sh文件中,找到cygwin=false,在这一行的前面加入参数,具体如下

# vi TOMCAT_HOME/bin/catalina.sh
JAVA_OPTS="-server -Xms800m -Xmx800m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:MaxNewSize=512m"

你可能感兴趣的:(Linux tomcat解决内存溢出)