Tomcat下java的虚拟内存调整(原创)

类别:Java 点击:0 评论:0 推荐:

把tomcat服务器java最大内存使用量调整为512m,有如下两种方式:

【1】设置环境变量
[root@WWW root]# vi .bash_profile

添加 export JAVA_OPTS="-mx512m -ms128m ",重启tomcat

【2】编辑catalina.sh文件
在 tomcat_home/bin/catalina.sh 这个文件里
找到下面:
# ----- Execute The Requested Command -----------------------------------------
echo "Using CATALINA_BASE:   $CATALINA_BASE"
echo "Using CATALINA_HOME:   $CATALINA_HOME"
echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
echo "Using JAVA_HOME:       $JAVA_HOME"

然后增加一行..
# ----- Execute The Requested Command -----------------------------------------
JAVA_OPTS="-server -Xmx512m -Xms128m -Djava.awt.headless=true "
echo "Using CATALINA_BASE:   $CATALINA_BASE"
echo "Using CATALINA_HOME:   $CATALINA_HOME"
echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
echo "Using JAVA_HOME:       $JAVA_HOME"

最后重启tomcat

本文地址:http://com.8s8s.com/it/it11442.htm