java.lang.OutOfMemoryError: PermGen space

解决办法增大tomcat JVM内存设置
参数说明:
-Xms128m  tomcat初始内存大小
-Xmx512m  tomcat可使用的最大内存大小
-XX:PermSize=128MJVM初始非堆内存大小
-XX:MaxPermSize=256mJVM可使用的最大非堆内存大小
在tomcat7/bin/catalina.bat文件中,找到下面的代码,增加红色字体一行内容:

rem ----- Execute The Requested Command ---------------------------------------


echo Using CATALINA_BASE:   "%CATALINA_BASE%"
echo Using CATALINA_HOME:   "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
if ""%1"" == ""debug"" goto use_jdk
echo Using JRE_HOME:        "%JRE_HOME%"
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME:       "%JAVA_HOME%"
:java_dir_displayed
echo Using CLASSPATH:       "%CLASSPATH%"


set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=


set JAVA_OPTS=-Xms128m -Xmx512m -XX:PermSize=128M -XX:MaxPermSize=256m


if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8000
:gotJpdaAddress
if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
set JPDA_SUSPEND=n
:gotJpdaSuspend
if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
:gotJpdaOpts
shift
:noJpda



如果需要在Myeclipse中启动tomcat则需要设置JDK面板中的启动参数
-Xmx256M -Xms128M -XX:MaxPermSize=128m

你可能感兴趣的:(java.lang.OutOfMemoryError: PermGen space)