Configure heap size for Tomcat 6.x

28 thoughts on “Configure heap size for Tomcat 6.x

  1. How to set java heap size in Tomcat?
    Stop Tomcat server, set environment variable CATALINA_OPTS, and then restart Tomcat. Look at the file tomcat-install/bin/ or catalina.bat for how this variable is used. For example,

    set CATALINA_OPTS=”-Xms512m -Xmx512m” (Windows)
    export CATALINA_OPTS=”-Xms512m -Xmx512m” (ksh/bash)
    setenv CATALINA_OPTS “-Xms512m -Xmx512m” (tcsh/csh)

    In catalina.bat or, you may have noticed CATALINA_OPTS, JAVA_OPTS, or both can be used to specify Tomcat JVM options. What is the difference between CATALINA_OPTS and JAVA_OPTS? The name CATALINA_OPTS is specific for Tomcat servlet container, whereas JAVA_OPTS may be used by other java applications (e.g., JBoss). Since environment variables are shared by all applications, we don’t want Tomcat to inadvertently pick up the JVM options intended for other apps. I prefer to use CATALINA_OPTS.


    1. Hi Abid / Dave,

      I’m very new to this setting JAVA_OPTS variable.
      Please can you explain in detail.

      Stepwise proc for configuring
      for linux machines as well(not much aware about the linux commands aswell)

      –one more question :
      1) If i have two tomcat application running on my windows XP ,does this JAVA_OPTS
      size apply for both, if yes how to make it specific for each application.

      2)what does Xms and DXms stand for.

      Thanks in advance

  2. To set the
    CATALINA_OPTS=”-Xms1024m -Xmx1024m”
    property in the or catalina.bat file, i should find these files firstly πŸ™‚ These files do not exist in my Tomcat 6 directory:
    C:\Program Files\Apache Software Foundation\Tomcat 6.0\

    How will I configure the heap size ?

    1. Look in the bin directory inside tomcat directory.
      If I can suggest you something, next time do a research with find (linux) or CTRL F (windows).
      Nice day πŸ™‚

    2. Hi All,
      To set the
      CATALINA_OPTS=”-Xms1024m -Xmx1024m”

      The above property in startup.bat file while is available in tomcat\bin directory path.

    3. Hi All,
      To set the below comment in startup.bat file as

      set CATALINA_OPTS=”-Xms1024m -Xmx1024m”

      startup.bat file is available in tomcat\bin directory path.

  3. hi,
    I want to configure the heap size in tomcat 6.0.

    In my tomcat directory i dont have the or catalina.bat file.
    How can i configure in this situation.

    Thanks in Advance…


  4. Hi All,

    1. I Recorded the Script for Company creation and User creation. When executing the Script it is displaying error message like “ Connection timed out: connect at Method) at Source)”

    How we can solve this Problem

    2. Can u send me the process how to Insert the Data in DB by using JMeter.

    3. In JMeter how many Vusers we can create


  5. Hi,
    I am using Window-XP. i make changes both in or catalina.bat but i think tomcat 6.0.14 not using those file.

    Kindly tell me how i increase my tomcat heap memory.


    Best Regards,
    Kamran Omar

  6. Thanks you so much ..i really spent a lot time on this but at many places it was not mentioned how exactly n where to place these arguments…cheers πŸ™‚

  7. what about how to solve java heap space errror in my tomcat i am using Ubuntu OS and everytime when i try to load a module in tomcat it’s shows the java heap space, need some help please

  8. Does anyone know what would be the minimum java heap size for Tomcat? Will tomcat run for example with only 48MB?

    1. Hi mingliangfeng, In my tomcat directory I don’t have the or catalina.bat file, however I can create the file setenv.bat, the question is: where do I invoque this file in the startup process?

  9. more of a tweet than a full blog entry, and the comments are 10x the size of the “post”. πŸ˜›

    I was actually searching to find out why tomcat 6 seems to leak so much memory and crash our servers.

  10. Even i tried increasing the size It aint worked out . Then what is the other procedure to follow ? can anyone help out with this java heap space issue. thanks in advance.

    1. Ramya says:

      to increase the heap memory size in tomact: tomact6.0->bin->startup.bat(rightclick->edit) and set like “set JAVA_OPTS=-Xmx512m -XX:MaxPermSize=256m”
      try this.

  11. to increase heap size for tomcat
    For windows os :MyComputer->properties->Advanced->environment variables->System variables->New->Variable name:CATALINA_OPTS->Variable value:-Xms64m -Xmx256m

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s