Allocating more RAM to Apache Tomcat on Windows

posted by SpringSource on April 15, 2010 08:36 AM

If you've recently upgraded the RAM, or are moving your Tomcat applications to a larger box, you may want to update your allocated memory.

To find out how much RAM is allocated already to your Tomcat instance, if you have Tomcat installed as a Windows service, you can run Regedit and look at:

Apache Software Foundation
Procrun 2,0

Under that key will be all the tomcat service instances you have installed on that machine. If you expand an instance tree you will see another key named Parameters. Expand this and you will see a number of named values:

JvmMs - is the minimum memory, equivalent to -Xms
JvmMx - is the maximum memory equivalent to -Xmx
Options - any other java options you wish to set for this server.

When you run Tomcat as a service it calls the jvm.dll directly so anything you modify in one of the bat files will be disregarded. So you will need to set those options by changing those registry values. The default Tomcat configuration does not use any memory configuration. If you haven't set the -Xms or -Xmx parameters explicitly anywhere you will wind up with the JDK default which is 64M.

Be aware that even if you increase the physical memory size, if you are running 32 bit windows you won't be able to allocate over 2GB of memory per VM. On Win32 the max size for your heap is going to be 2 GB. While that is as big as it will be able to get on that platform, that does not necessarily mean that you will be able to allocate a 2GB heap. In order to achieve that, the JVM must be able to allocate that entire quantity in a set of contiguous addresses. Depending on what you have loaded, if there is anything loaded into memory that is not movable and interferes with allocating that block, it will fail to start and you'll have to reduce the size until it fits in what IS available.

There are a number of different ways to modify the memory settings for the JVM at Tomcat startup via the -Xmx and -Xms settings. 

You can set these (and other JVM parameters) in either the JAVA_OPTS or the CATALINA_OPTS in the set_env.bat. These can also be set via the Windows System Environment dialogs. If that has been done you can type set JAVA_OPTS OR set CATALINA_OPTS at the command prompt, and if they are set you will see them. Or they can be set from the command line before starting Tomcat (although if that was being done it wouldn't help you in this case). These can also be set in any of the called startup scripts such as startup.bat, catalina.bat, or set_env.bat. Do a text search through all the bat files and check to see whether the environment variables are being explicitly set somewhere there.

Normally, the quickest way to find out what the actual startup setting is would be to edit catalina.bat. 

Find the tag: doneSetArgs. Immediately after that add the line:


When you next type startup it will print out the exact command line being used to start Tomcat. If you see an -Xmx parameter, the value immediately after that will be your maximum memory for that instance. If you don't see that setting at all, it is the JVM default, 64M.

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.


Memory Allocation

What is the most amount of memory you could allocate to tomcat in a x64 OS?

And then secondly, what is the best way to allocate or set the values xmx, xms, permsize?


These can also be set via the

These can also be set via the Windows System Environment dialogs.

how to buy soundcloud plays

I am in same problem

Thanks for your wonderful tutorial.But need more explain how to upgrade ram.Some point are not clear so if you can explain that will be easy for us.
Aero Auto
Webs: Auto transport California

here i got the way to get

here i got the way to get marvel contest of champions hack with the hack and cheat

On unionized campuses, there

On unionized campuses, there may also be contractual limits on section size that were CAS-001 vce designed with the traditional model in mind but that do not make sense for a hybrid model. It is possible that these constraints would be changed in future contract negotiations, but that too will take time.

Post new comment

This question is for testing whether you are a human visitor and to prevent automated spam submissions.