修改Tomcat的运行内存

在catalina.bat中加上红色那行

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= -Xms512M -Xmx1024M

===JSP中查看当前的内存使用状况=

Runtime lRuntime = Runtime.getRuntime();

out.println("*** BEGIN MEMORY STATISTICS ***");

out.println("Free  Memory: "+lRuntime.freeMemory()/1024/1024+"M");

out.println("Max   Memory: "+lRuntime.maxMemory()/1024/1024+"M");

out.println("Total Memory: "+lRuntime.totalMemory()/1024/1024+"M");

out.println("Available Processors : "+lRuntime.availableProcessors()+"");

out.println("*** END MEMORY STATISTICS ***");

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.