Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Inside the /etc/tomcat6/tomcat6.conf file, the JAVA_OPTS configuration line gives me the ability to set memory limits for Tomcat.

For example:

JAVA_OPTS="-Xms256M -Xmx1024M -XX:MaxPermSize=256m -XX:PermSize=128m"

Is there a way to disable memory limits for Tomcat entirely? I want Tomcat to make use of all available memory - I don't want to artificially limit the JVM with these parameters.

Alternatively, is there any harm in making these limits really large?

share|improve this question
Starting Tomcat is just instantiating JVM, with some libraries in the classpath. And that requires to set the heap size and memory size. – Alfabravo Jun 14 '12 at 18:20
up vote 2 down vote accepted

This is not related to Tomcat really, but is something every Java application has to deal with. There's plenty of resources on the net, e.g. this:

share|improve this answer

You have to specify an actual amount of memory.

HOWEVER, if you give all of the system memory to the JVM, you leave nothing for the actual machine itself to use, and therefore you will most likely get system crashes or really bad performance at least. Besides, if the only fix you have is to throw more memory at the JVM, you may want to look at better, more optimized code and doing actual profiling to find the problem areas.

share|improve this answer

I would caution against not setting these, especially in the event of a memory leak -- which might take up most (all?) memory on your system. Also, in the event of a garbage collection, your application's pause time might become unacceptable if memory usage is unchecked.

Sizing the JVM depends on a lot of factors: Your application's "footprint", RAM available on the server, other processes running on the server, etc. You will be happier in the long run if you profile your app using some load testing/profiling tool, examining your garbage collection logs, server resource consumption, etc., and tweak these settings, instead of leaving them out. IMO, you should run a lean, well-tuned application (-:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.