aspose file tools*
The moose likes Tomcat and the fly likes Setting JVM Heap Size in Tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Setting JVM Heap Size in Tomcat 5.5" Watch "Setting JVM Heap Size in Tomcat 5.5" New topic
Author

Setting JVM Heap Size in Tomcat 5.5

David Schectman
Greenhorn

Joined: Jan 03, 2005
Posts: 3
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
David Schectman
Greenhorn

Joined: Jan 03, 2005
Posts: 3
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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Jan 03, 2005
Posts: 3
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

Joined: Dec 11, 2004
Posts: 13410

Originally posted by David Schectman:
Thanks for you help.

No problem, glad I could help.
-Ben
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting JVM Heap Size in Tomcat 5.5