Saturday, September 27, 2014

How to increase heap size of tomcat service in windows?

How to increase heap size of tomcat service in windows?

If you run tomcat using the startup.bat then you will have to put following in your catalina.bat for JAVA_OPTS

set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1152m -XX:MaxPermSize=512m -XX:MaxNewSize=512m

But what if you made tomcat as a windows service? Then even if you put above values in catalina.bat file, and restart your tomcat service, still it will have no effect. 

Reason is the tomcat service reads these values from different location.
To set the heap size for tomcat service in windows see below screenshots :

Step 1: Go to C:/Tomcat6.0.16/bin
Step 2 : Double click the tomcat6w.exe or if you have renamed it to xyz.exe then double click on it.
Step 3: It will open window like below :
Step 4: Click on the "Java" tab
Step 5 : Set values Initial memory pool : 512 this is your -Xms512m

Set value Maximum memory pool : 512 , this is your-Xmx1152m.

For setting -XX:MaxPermSize=512m -XX:MaxNewSize=512m, you will have to enter these values in Java Options text box as shown in above screenshot.

Step 6 : That's all, click "OK", and Restart tomcat service through "services.msc".
This is How to increase heap size of tomcat service in windows?


No comments: