You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sq...@comcast.net on 2003/09/24 20:53:11 UTC

Tomcat heap memory allocation in Linux

Hi,

I am using tomcat 4.1.27 running on Red Hat Linux 9 and Sun's JDK 1.4.1_01.  
Here is my issue.  I wanted to allocate more heap space to run tomcat.  So, I 
placed the following line in the file catalina.sh:

  JAVA_OPTS="-Xms256m -Xmx400m"

I shut down tomcat, reboot linux, and started tomcat.  I executed the command 
top to verify the memory is actually being used up by tomcat.  Here is the 
result of the top command:

CPU states:  0.5% user,  8.7% system,  0.0% nice, 90.7% idle
Mem:   384716K av,  183864K used,  200852K free,       0K shrd,   18980K buff
Swap:  257000K av,   28672K used,  228328K free                   59340K cached

If you noticed, memory usage is less than the 256MB that I specified.  If you 
consider that other processes are also running, tomcat is not consuming the 
initial 256MB that I specified in the JAVA_OPTS.  I thought maybe the start 
command for tomcat is worry.  So, I ran a ps on the tomcat process and got the 
following:

UID        PID  PPID  C STIME TTY          TIME CMD
root      6982     1  0 15:11 pts/1    00:00:11 /var/app/java/bin/java -
Xms256m -Xmx400m -Djava.endorsed.dirs=/var/app/tomcat/bin:/v

I think this showed the executed command to start tomcat is correct.  I am not 
sure what is going on.  Is the top command not returning an accurate reading?  
Am I forgot to do something here?  By the way, I also tried CATALINA_OPTS 
instead of JAVA_OPTS and got the same result.

Here is the strange thing.  When I used the JAVA_OPTS with tomcat 4.1.27 
running on Windows2000 server and Sun's JDK 1.4.1_01, tomcat is actually 
consuming the initial memory that I specified in JAVA_OPTS.

Does anybody have an idea?  Any help would be appreciated.

Thanks,

Son