Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Out of Memory with high Free Memory

 
Archana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9319
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Archana" please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.
 
Archana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the application log
 
Bhaskar Rao
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic