On Tue, 2012-02-14 at 05:07 -0800, Alfredo Alessandrini wrote: > Hi, > > I'm running tomcat 7.0.25 in a shared server (centOS 64bit). > > Memory limit for my account is 256m. > > I'm running tomcat with this settings: > > export CATALINA_OPTS="-Xms128m -Xmx256m" > > export JAVA_OPTS="-Xms128m -Xmx256m"
1.) You don't need to specify both CATALINA_OPTS and JAVA_OPTS. Putting these values into CATALINA_OPTS should be sufficient. 2.) Setting "-Xmx" will set the maximum size for the Java Heap. This is different than the total memory used by the OS process. > > But the process exceed the limit that I've set: > > RSS ELAPSED PID COMMAND > 318340 01:14 37152 /home/keol/java/bin/java > -Djava.util.logging.config.file=/home/keol/webapps/tomcat/conf/logging.properties > -Xms64m -Xmx128m > -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager > -Xms64m -Xmx128m > -Djava.endorsed.dirs=/home/keol/webapps/tomcat/endorsed -classpath > /home/keol/webapps/tomcat/bin/bootstrap.jar:/home/keol/webapps/tomcat/bin/tomcat-juli.jar > -Dcatalina.base=/home/keol/webapps/tomcat > -Dcatalina.home=/home/keol/webapps/tomcat > -Djava.io.tmpdir=/home/keol/webapps/tomcat/temp > org.apache.catalina.startup.Bootstrap start > > There is a way to limit the memory usage? The total size of the Java OS process consists a few different elements. 1.) the Java Heap 2.) PermGen Space 3.) Thread Stacks 4.) Some other minor things You can limit the first with "-Xmx" and the second with "-XX:MaxPermSize". You can't limit the overall thread stack size, but you can lower the per thread stack size with "-Xss". Off the top of my head, that's all I can think of for limiting the JVM. However, you may have one other option. If your OS supports a way to limit the amount of memory available to a process, you could try that as well. Dan