2

I recently downloaded the latest Java 1.6 JDK. I'm using VisualVM which came with the SDK to test/monitor my webapp (using Tomcat server) on my local pc. I'm running Windows XP.

Where are the parameters located for setting the min. and max. java heap size? VisualVM indicates that the max. heap is at about 256mb. I looked in the server.xml file for Tomcat, but didn't find any settings in there.

Thank you

trincot
  • 317,000
  • 35
  • 244
  • 286
katura
  • 2,177
  • 14
  • 39
  • 48

3 Answers3

8

You can use the JAVA_OPTS environment variable for dealing with java heap size. This variable can be added as a environment variable as well as you can define a configuration line in the startup.bat file.

Add the following line in the startup.bat file.

set JAVA_OPTS=-Xms512m -Xmx512m

You can add this as environment variable as said.

vijay.shad
  • 2,444
  • 6
  • 27
  • 33
  • Are you sure it should be `server.xml` file? It should be some file where you run JVM (see matt b answer). – Lukasz Stelmach Nov 29 '10 at 22:44
  • ouch.. sorry about that. I have edited the answer with correct file name. It should be startup.bat – vijay.shad Nov 29 '10 at 22:54
  • Your solution worked for me. I just updated the startup.bat file and I started VisualVM...the changes have taken effect. – katura Nov 30 '10 at 16:04
  • -Xms512m -Xmx512m You should look for these values and find out what they do. As you see i have used maximum and minimum to 512m. But this does not be the case always. You may want to change these values. – vijay.shad Dec 01 '10 at 00:22
3

These parameters are passed to JVM via command line: -Xms and -Xmx For more information run java -X.

AlexR
  • 114,158
  • 16
  • 130
  • 208
0

The best place to place these settings is in setenv.bat or setenv.sh in the bin folder. Take a look at a recent SO question on the same topic which has excellent answers.

Community
  • 1
  • 1
matt b
  • 138,234
  • 66
  • 282
  • 345