Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting JVM Heap Size in Tomcat 5.5

 
David Schectman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I installed version 5.5 and java 1.5 on a system running windows server 2003 with 1.5G of RAM. I created a system environment variable JAVA_OPTS = -Xms128m -Xmx512m to set the initial heap size to 128M and the maximum to 512M. After creating the variable, I restarted the tomcat service. Despite this, my servlet is running out of memory. I added code to the init method to log the total memory and free memory available to the JVM

Total memory 6.6650112E7
Free memory 2.2165176E7

The total memory indicates that it is still set to 64M. How do I increase it?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is tomcat installed as a windows service?
If so, it's not paying attention to the environment variables.

If you installed the start menu items click:
Start->Programs->Apache Tomcat->Tomcat Configuration.

There is a Tab for Java settings. There are two field for memory settings.
 
David Schectman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the information.

Yes, it is installed as a windows service.

C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin\tomcat5.exe" //RS//Tomcat5

When I click on the start menu option to configure tomcat (or the one to monitor tomcat), I get the message "an instance of 'tomcat5' application is already running". I tried stopping the server and I get the same message.

Can I configure these in a tomcat config file or only by the configuration program?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They're stored in the registry.

You're not trying to start Tomcat from that screen, are you?
Just click on the 'Java' tab and fill out the fields for initial memory pool and maximum memory pool.
 
David Schectman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you help. Problem solved. There was a tomcat administration process (not application) already running. How it was statred, I do not know. After stopping this process, I could get to the admin screen to configure the memory. I restarted the tomct service and it works
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David Schectman:
Thanks for you help.

No problem, glad I could help.
-Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic