Tomcat中设置JVM的内存及Dump文件转储
Linux环境下在catalina.sh中设置:
JAVA_OPTS="-server -Xms1024m -Xmx1024m -Xmn512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/XXX/testdump"
# OS specific support. $var _must_ be set to either true or false.
Windows环境下在catalina.bat中设置:
set JAVA_OPTS=%JAVA_OPTS% -server -Xms1024m -Xmx1024m -Xmn512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:heapdump
rem Suppress Terminate batch job on CTRL+C
注意:jdk8中设置-XX:PermSize=256m -XX:MaxPermSize=256m会如下警告,提示删除这个参数。
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0