Permalink to this page: https://cwiki.apache.org/confluence/x/RSolBg

Preface

This page discusses various memory issues. In a nutshell - if your computer has less than 128MB of ram - you will probably have trouble. Anyhow, also read the following threads for other memory related issues:

Also look at YourKit, or maybe you IDE has a profiling tool in it, or other profiling tools are available. (The following tools were recommended by many people in the past, but now seem to be discontinued by their vendors: JProbe by Quest Software — the company was acquired by Dell, OptimizeIt by Borland). This is not an endorsement for them, I just notice other people like them.

Questions

  1. How do I adjust memory settings?
  2. Why do I get OutOfMemoryError errors?
  3. How much memory is Tomcat/webapp/??? using?

Answers

How do I adjust memory settings?

First look at java -X to determine what parameters to set. Then you can set them via the environment variable CATALINA_OPTS (using JAVA_OPTS also works, but is not recommended). This variable is usually set in a file bin/setenv.sh or bin/setenv.bat that you may need to create by yourselves.

The setenv file is documented in RUNNING.txt in your version of Tomcat. The environment variables are described in a comment at the top of catalina.bat or catalina.sh files.

Why do I get OutOfMemoryError errors?

Many reasons.

See also OutOfMemory and MemoryLeakProtection.

How much memory is Tomcat/webapp/??? using?