Solved

Increasing Heap Size in Tomcat 4.1

Posted on 2006-06-21
9
1,815 Views
Last Modified: 2010-05-18
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
Comment
Question by:rospcc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 4

Expert Comment

by:pablomorales
ID: 16951903

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
 

Author Comment

by:rospcc
ID: 16956949
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17079909
0
 

Author Comment

by:rospcc
ID: 17079936
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
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17080061
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
 

Author Comment

by:rospcc
ID: 17371351
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
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 17399965
PAQed with points refunded (500)

GhostMod
Community Support Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
A look at what happened in the Verizon cloud breach.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question