Solved

Increasing Heap Size in Tomcat 4.1

Posted on 2006-06-21
9
1,796 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

10 Experts available now in Live!

Get 1:1 Help Now