• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

increase java heap size

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this has been asked before, and I have tried to read the answers and implement their suggestions, but I have not succeeded yet. I have Tomcat 5.5 running as a Windows Service. I am running Windows XP SP2, with 2GB or real memory. The Tomcat service is started automatically at system start-up, not from a Start menu. I need to increase the heap size. I have tried setting CATALINA_OPTS in the system environment variables. It is now CATALINA_OPTS=-Xms64m -Xmx256m However, when I look at Tomcat status, I see Free memory: 17.16 MB Total memory: 63.56 MB Max memory: 63.56 MB.

How can I increase the heap size?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you install this way, these settings are kept in the Windows Registry.
If you have the start menu items, the easiest way to change them is to go to
Start -> Programs -> Apache Tomcat -> Tomcat Configuration -> Java (tab).
There are fields for your initial and max heap sizes.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Michael Zellmann
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks !
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First Calculate the number of threads you can create

(MaxProcessMemory - JVMMemory - ReservedOsMemory) / (ThreadStackSize) = Number of threads

Example:

For Java 1.5 you will get the following results assuming that the OS reserves about 120MB:

1.5GB allocated to JVM: (2GB-1.5Gb-120MB)/(1MB) = ~380 threads

1.0GB allocated to JVM: (2GB-1.0Gb-120MB)/(1MB) = ~880 threads

Your Java Options Example:

-Xms 512m
-Xmx 1024m
-Xss256k
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m

For More Details i Found this link
http://www.reviewservers.com/index.php?page/tomcat

we wish this may help you
 
Ranch Hand
Posts: 1327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
if I wish to increase the maximum memory setting without using the Tomcat coniguration window(non windows environment) but modify the catalina.bat(or catalina.sh)
do I just add a line CATALINA_OPTS='-Xmx512m' in catlina.bat(.sh) or startup.bat(startup.sh) ?

or is it JAVA_OPTS=CATALINA_OPTS='-Xmx512m'

thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The bat files are for Windows and the sh files are for unix.
And it's JAVA_OPTS.
 
Billy Tsai
Ranch Hand
Posts: 1327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so do I add JAVA_OPTS='-Xmx512m' to catalina.sh or startup.sh?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
Append following line in catalina.bat in front of JAVA_OPTS
-Xms1024m -Xmx1024m -XX:MaxPermSize=128m

It should look like.


there is another solution.
add a new environment variable called JAVA_OPTS with value
 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The maximum memory for JVM on windows machine is limited to 1.6 Gigs.
Sometimes, you do need more than that. But, can't do.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[quote=Anubhav Anand]The maximum memory for JVM on windows machine is limited to 1.6 Gigs.
Sometimes, you do need more than that. But, can't do.[/quote]

I do not have catalina.bat in my bin folder ... should i be setting this in the environment variables?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

I am using Tomcat 6.0.24 as Windows Service. There is no startup.bat.

Googling I stumbled with this blog post:

http://blog.scottpenrose.com/2009/01/29/modify-windows-tomcat-service-heap-size/

Here it says to execute "tomcat6 //US//Tomcat6 –JvmMs XXX –jvmMx YYY" in tomcat/bin folder.

I executed tomcat6 //US//Tomcat6 –-JvmMs=512 –-jvmMx=1024 and it is working now. I hope it helps somebody
(ref: http://tomcat.apache.org/tomcat-5.5-doc/windows-service-howto.html)

Cheers,
Bruno
 
reply
    Bookmark Topic Watch Topic
  • New Topic