Solved

Increasing Heap Size in Tomcat 4.1

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

Expert Comment

by:kaliyugkaarjun
ID: 17079909
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

We need a new way to communicate time sensitive or critical info.   The best part of my role at xMatters is visiting our clients all over the world to learn about how they operate their businesses, share insights that xMatters has gleaned across…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now