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?
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:
http://javarevisited.blogspot.de/2011/05/java-heap-space-memory-size-jvm.html
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.
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 (-: