File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Out of Memory with high Free Memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Out of Memory with high Free Memory" Watch "Out of Memory with high Free Memory" New topic
Author

Out of Memory with high Free Memory

Archana
Greenhorn

Joined: Nov 26, 2008
Posts: 2
I have an application running in Tomcat in a machine with 3 GB RAM. The JVM memory ha been set to 1.5 GB.

OS: fedora core9
Tomcat version: 5.0.19
java: 1.4.2
java -x parameters : Xms1536m -Xmx1536m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:NewSize=384m -XX:MaxNewSize=768m

My application crashes every 3-5 days. I cant find out any memory leaks in my program, and when i check the free memory at that time, (using java runtime freeMemory(), it always prints a value between 700MB to 1 GB).

To simulate the situation, i tested the application many times, by tracking the memory usage giving a high load on the application, Then i can see the free memory going down and then again going up and thus application runs without any issue.

I am totally lost, please help..
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Welcome to the JavaRanch.
What does the stack trace of the out of memory error look like?
It's possible to run out of memory in perm gen space and still have a ton of heap memory available. The stack trace will tell you which memory you've run out of.


[How To Ask Questions On JavaRanch]
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2718
    
    6

"Archana" please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
Archana
Greenhorn

Joined: Nov 26, 2008
Posts: 2
Originally posted by Joe Ess:
Welcome to the JavaRanch.
What does the stack trace of the out of memory error look like?
It's possible to run out of memory in perm gen space and still have a ton of heap memory available. The stack trace will tell you which memory you've run out of.



Thanks for your comment. I cant find out the stack trace of the error, the only message displayed in tomcat's catalina log file is, java.lang.OutOfMemoryError. Please let me know if there is any other way to find out the same?
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Check the application log
Bhaskar Rao
Greenhorn

Joined: Apr 25, 2005
Posts: 23
Hi,

Have you tried using a profiler? You can find out if there are any memory leaks in your application. I did use one such profiler to find a memory leak.

Have you checked the catalina.out for any GC logs?
I am not sure if tomcat outputs GC logs by default. if not, I think you have to change one of the the JVM args. It will then log memory used by the heap before and after each GC and the total available memory. This should at least tell you if the heap memory is used up by unused objects over time before you get the out of memory error.
Reinaldo de Carvalho
Greenhorn

Joined: Dec 06, 2008
Posts: 11
I had some problems with that, too.
in my case, the problem was with the memory allocated for threads.
if that is your problem, here the link where i found the solution.
a parameter in jvm, "-Xss<memory>"
http://www.talkingtree.com/blog/index.cfm/2005/3/11/NewNativeThread


Reinaldo de Carvalho
Bahia - Brazil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Out of Memory with high Free Memory