set JAVA_OPTS=-Xms512m -Xmx512m
如果你是使用service启动的话,请打开regedit编辑注册表:
HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters\Java
(注:64位Windows7可能在HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters\Java)
找到叫做Options的key,打开可以看到:
-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 6.0
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 6.0
-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 6.0\endorsed
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\logging.properties
请在最下面添加:(要有回车)
-Xms512m
-Xmx512m
若是从MyEclipse启动Tomcat,则preference-MyEclipse-Application Services-Tomcat-Tomcat 6.x-JDK处添加参数:
-Xms512m -Xmx512m
或者preference-java-instal jres-edit增加参数:
-Xms512m -Xmx512m
重启Tomcat,之后打开http://127.0.0.1:8080/manager/status即可看见JVM内存有增加了:
JVM
Free memory: 361.14 MB Total memory: 490.68 MB Max memory: 490.68 MB