Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1822
  • Last Modified:

Increasing Heap Size in Tomcat 4.1

Hi All,

I've tried to increase CATALINA_OPTS to = "--Xms128M -Xmx1024M".

I tried the following commands to check the heap size:
long heapSize = Runtime.getRuntime().totalMemory(); //Btw, what's this totalMemory() ?
long heapMaxSize = Runtime.getRuntime().maxMemory();
long heapFreeSize = Runtime.getRuntime().freeMemory();

I've got the output as follows:
heapSize = 11632640
heapMaxSize = 530907136 (Does this mean the Max Size is 530MB? It doesn't increase to 1GB)
heapFreeSize = 3373504 (Free memory is only 3MB, does this cause the system to prompt "Out of Memory" error?)

Please advise.
0
rospcc
Asked:
rospcc
1 Solution
 
pablomoralesCommented:

If you are running tomcat as a Windows service you may have to go to the registry:

1. Logon to the application server
2. Go to Start -> Run, and type regedit to open the registry editor
3.Locate Tomcat (My Computer -> HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services -> Apache Tomcat 4.1 -> Parameters)
4. Look for ‘JVM Option Number 3’ parameter. Value may be “–Xms128m” (128 is the number of megabytes; this number should be somewhere roughly between 1/4th – 1/3rd of the total RAM on the machine)
5. Look for another parameter named “Java Option 4”. Value may be “–Xmx512m” (512 is the number of megabytes; this number usually be somewhere around half the total RAM on the machine)

If you are the using the hot spot client vm that may be the problem:

"i had a same problem with an application which runs out of mem with client vm with a maximum heap size of about 450M but it uses just 70-80M with server vm ."

0
 
rospccAuthor Commented:
I tried to edit the registry value you are talking about but i couldnt find Apache Tomcat 4.1 in the "My Computer -> HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services" directory. Any idea what is wrong?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kaliyugkaarjunCommented:
0
 
rospccAuthor Commented:
Dear kaliyugkaarjun,

The thread starter for second link that you posted is actually my post as well. I already managed to found a solution for it but ultimately i would still like to know how can i increase the heap size of tomcat.

The first link returned me with error.
0
 
kaliyugkaarjunCommented:
Hi
I am sorry ...I didn't notice it...

THis link is working and may help u
http://support.novell.com/docs/Tids/Solutions/10070512.html

another solution am giving but i think u hav already tried it...

 The solution is to configure Tomcat to use a larger heap size. This can be done by editing [TOMCAT_DIR]/bin/catalina.bat (MS Windows) or catalina.sh (Unix systems). You can increase the heap size by adding a parameter to the environment variable JAVA_OPTS. The parameter to be added is '-Xmx128M' (where the number 128 indicates that 128 Megabytes should be used. Increase as required). For catalina.bat there now should be a line in your file that looks like this:

set JAVA_OPTS=-Xmx128M

For catalina.sh the line should look like this:

JAVA_OPTS='-Xmx128M'
0
 
rospccAuthor Commented:
Mod: I would like to have my points refunded.

Reasons: The solution given by kaliyugkaarjun has actually been tested by me and it is not working. For reference, you can go to this link http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21888641.html#17370931

Thank you.
0
 
GhostModCommented:
PAQed with points refunded (500)

GhostMod
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now