Solved

Increasing Heap Size in Tomcat 4.1

Posted on 2006-06-21
9
1,806 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
 
LVL 8

Expert Comment

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

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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