wood burning stoves*
The moose likes Tomcat and the fly likes Increase memory for tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Increase memory for tomcat" Watch "Increase memory for tomcat" New topic
Author

Increase memory for tomcat

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
Guys, i want to increase heap maximum memory and initial memory, my tomcat runs in windows 2000 server, if I set JAVA_OPTS enviroment variable to -Xms128m -Xmx128m will it work??
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

it should.
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
how can I test it??
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Look at the methods in java.lang.Runtime
long maxMemory() long freeMemory() and long totalMemory()

You could insert these lines in any init method.
Runtime rt = Runtime.getRuntime();
System.out.println("Maximum memory available is " + rt.maxMemory() );
Bill
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
it didn't change!! the max memory doesn't change.
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
Could some one help me here!? the max memory doesn't change with JAVA_OPTS set to -Xms256m -Xmx256m...
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
1. Exactly where are you changing JAVA_OPTS?
2. How do you start Tomcat?
3. What is it currently reporting as maxMemory()?
Bill
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
Always reports something like this (only 'Free memory' changes)
I set JAVA_OPTS enviroment variable to -Xms256m -Xmx256m. I also made a program to print the max memory and started it by prompt with the following command java test -Xmx256m -Xms256m and the max memory does not change.

Max memory: 134.217.728
Free memory: 21.686.320
Total memory: 63.979.520
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

If you start Tomcat with the provided batch files, then try altering JAVA_OPTS in the batch file, not as a (system) environment variable. If you've installed as a service, then there are ways of altering this as well, but it involves hacking the registry (I think).

Also, just for the heck of it... you are sure that 256MB is *available* on your server to be allocated?
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
I have 1GB available for tomcat but it uses only a few of it... It's installed as service, could you help me increase its memory??
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Installed as a service! Thats the problem. As a service it does NOT see your environment variables that you set as a user.

This discussion - right at the bottom of the page. tells how somebody solved the problem with a very similar setup.

Bill
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
Thanks to you all I could increase tomcat 4x memory as service, by modifing entries in regedit... but I need to increase tomcat 5.x memory!! have you seen any other guy trying the same in any other forum??
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

http://marc.theaimsgroup.com/?l=tomcat-user&m=107455856018159&w=2
Tonny Tssagovic
Ranch Hand

Joined: Dec 30, 2003
Posts: 226
Hello folks,
I just wanted to ask confirm about passing params as Xms to tomcat while it is running as a service. Here is what I found:

For Tomcat on NT as a service, you can set the -Xms and -Xmx in the
registry. Its HKEY_LOCAL_MACHINE\Service\CurrentControlSet\<Name
of
Service>\Configuration. You can add new JVM Option Number X (and
make sure
to increment the JVM Option Count key) to contain the additional
parameters.


Tomcat as service

I wanted to ask you guys, in case I have

and I don't increase it, but add a new (5.th JVM option) in the registry will it just be ignored??? And the order of the options passed to the JVM odes not matter?
Any help will be appreciated.
Tonny Tssagovic
Ranch Hand

Joined: Dec 30, 2003
Posts: 226
This guy seems to have it all
Tomcat service params
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Increase memory for tomcat