场景
启动tomcat的时候报错:
java.lang.OutOfMemoryError: PermGen space
解决方案
查看内存,如果小的话,清空缓存:
free -m; # 查看内存
echo 1 > /proc/sys/vm/drop_caches; # 清空缓存
编辑catalina.sh ,首行加入内容:
set JAVA_OPTS=%JAVA_OPTS% -server -XX:PermSize=256M -XX:MaxPermSize=512m
或
export CATALINA_OPTS="-Xms1024M -Xmx1536M -XX:PermSize=2048m -XX:MaxPermSize=2048m"
sh catalina.sh 为什么会出现如下内容?
commands:
debug Start Catalina in a debugger
debug -security Debug Catalina with a security manager
jpda start Start Catalina under JPDA debugger
run Start Catalina in the current window
run -security Start in the current window with security manager
start Start Catalina in a separate window
start -security Start in a separate window with security manager
stop Stop Catalina, waiting up to 5 seconds for the process to end
stop n Stop Catalina, waiting up to n seconds for the process to end
stop -force Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
stop n -force Stop Catalina, wait up to n seconds and then use kill -KILL if still running
configtest Run a basic syntax check on server.xml - check exit code for result
version What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is defined