牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

Tomcat – More Memory – CATALINA_OPTS tomcat的内存设置

转载自:http://readwall.blog.163.com/blog/static/1012713220106610347337/

这篇文章是对内存调整真正起作用的,

 

CATALINA_OPTS or JAVA_OPTS?

CATALINA_OPTS is used to control Tomcat environment options, whereas JAVA_OPTS controls the environment options at a higher level ie. for any Java library.

You can start Tomcat with more heap memory using the following:

On Windows
Edit the file $TOMCAT_HOME\bin\startup.bat and insert or alter the following line, substituting for the desired values:
set CATALINA_OPTS=-Xms(min heap)m -Xmx(max heap)m

For example if you want to allocate a minimum heap size of 256MB and a max heap size of 512MB you will have to write the following on Windows:
set CATALINA_OPTS=-Xms256m -Xmx512m

The line you add should go just before the line starting call “%EXECUTABLE%”…

If you are running tomcat 5.5 via tomcat.exe, you can update the heap size by running tomcatw.exe and setting the required values via the Java tab.

On Linux
Edit the file $TOMCAT_HOME/bin/startup.sh and insert the following line, substituting for the desired value, eg. Bash Shell:
export CATALINA_OPTS=”-Xms(min heap)m -Xmx(max heap)m”

The line you add should go just before the line starting exec “$PRGDIR…

Permanent Generation Size

If you get the error message: java.lang.OutOfMemoryError: PermGen space you need to add the argument -XX:MaxPermSize=128m to CATALINA_OPTS, in addition to any argument you use to set the heap size.

 

posted on 2012-05-02 15:41 杨粼波 阅读(4572) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理