tomcat调整内存大小

在有些时候,tomcat会出现内存不足的问题,抛出outofmemory等异常,可通过调整内存大小解决。

1. 非安装版:

用记事本等编辑软件打开bin目录catalina.bat,找到set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%(约150行),在其下面添加:

set JAVA_OPTS=%JAVA_OPTS% -server -Xms512m -Xmx512m -XX:MaxNewSize=256m -XX:PermSize=512M -XX:MaxPermSize=512m

其中的大小可根据实际情况调整,保存,启动即可。

2.安装版:

运行Configure Tomcat,打开java标签页,在下方空的框(Initial memory pool, Maximum memory pool)中填写数值,例如Initial memory pool 256,Maximum memory pool填512,点击应用,启动tomcat即可。

 

如果无法启动,可能是内存设置太大,可考虑适当调小。

This entry was posted in Computer, Java. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s