Please help

Hi Guys,

I am working in a maintanance project. One of our application is showing out of memory error in every 3-5 days and crashes. It is running on tomcat which is set as a service. The current settings for for maximum heap is -Xmx512m, minimum is -Xms256m which sets at 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache Tomcat 4.1\Parameters' and the system has got just above 3.5 GB of RAM. One more tomacat and jboss is running on this machine.

The option in front of me are to increase the heap to 512-1024 or setup a scheduled resart at every night.

Obviously I would prefer to do the first option but I do not know if I just increase the heap size of JVM will at affect the performance of the server or not. If I am going for heap increase, does it need a restart to take the changes in effect?

Or

Shall I go with a scheduled resart at every night?

Your early advice is much appreciated. Thanks in advance.

[974 byte] By [Java_Suna] at [2007-11-26 17:38:24]
# 1
Rather than attacking the symptoms. I would suggesting find the cause. If you fix the memory leak you won't have to make the decision between the two choices.
zadoka at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

This is such a huge and famous application widely used by people. Finding out the coding memory leaks and rectifying it will take a lot of time. User wanted this issue to be fixed by some work around as they do not want any outage for the application. I am just looking for a work around now. Detailed analysis needs to be done later.

Java_Suna at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
One more thing: In windows task manager I can see the memory used by tomcat.exe, is it the heap memory used by JVM? Otherwise how do I check how fast the memory is growing? This application is been accessed by a lot of people, so will these sessions increase the heap memory usage?
Java_Suna at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4

> This is such a huge and famous application widely

> used by people.

What difference does it make if it is big or if it is "famous"?

> Finding out the coding memory leaks

> and rectifying it will take a lot of time.

>User

> wanted this issue to be fixed by some work around as

> they do not want any outage for the application.

Setting the memory higher might just make a little longer before you have an out of memory error.

>I am

> just looking for a work around now. Detailed analysis

> needs to be done later.

If someone had a problem with weight and asked for advice as to whether they should just buy bigger pants or get liposuction every week. You would say neither because that is attacking the symptoms not the root issue which is you need to stop eating so much.

This situation is the same, you might be able to mask some of the symptoms, but there is a problem in the code that needs to be addressed.

zadoka at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5

> One more thing: In windows task manager I can see the

> memory used by tomcat.exe, is it the heap memory used

> by JVM? Otherwise how do I check how fast the memory

> is growing? This application is been accessed by a

> lot of people, so will these sessions increase the

> heap memory usage?

When you say things like a lot, it really just makes things more confusing. Please specify, because a lot of people for you might mean 1,000. Where as to someone else it might be 50,000.

Yes, the more people connecting to your application at once is going to require more memory. But that still doesn't get the root issue (which I am sure you are tired of hearing me point out to you).

zadoka at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6

What is the detail string from the OutOfMemoryError? Usually it is

java.lang.OutOfMemoryError: java heap space.

But there are other possibilities. If you can cut and paste the exact message, that may help.

Also, add the options '-XX:+PrintGCDetails -XX:+PrintGCTimeStamps' to your java command line and save the output. The next time it fails, post the log (or if it's huge, the last part of it). Be sure to include a list of all of the java command-line arguments as well as the output from 'java -version'; that will give us a place to start.

jxca at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 7

Hello,

If you are interested to find how the JVM use up the heap storage then there are lots of Java Profiling tools. JProfiler is one such tool that you can use for profiling your tomcat server and applications. For more information please refer to the following link: http://www.ej-technologies.com/products/jprofiler/overview.html

Regards,

Janeve

Janeve_Reckonera at 2007-7-9 0:06:33 > top of Java-index,Java HotSpot Virtual Machine,Specifications...