• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Out of Memory with high Free Memory

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Bartender
Posts: 9625
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check the application log
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic