Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemory

 
Ludmila Snova
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We are running a stress test for a web application. And, after a 4 hours of heavy load the app server (WAS) crushes with OutOfMemory error.
The following piece is from GC log:



It looks like there are a lot of soft references to the sun.reflect.GeneratedMethodAccessor class and GC cannot properly clean it. But we don�t use soft references directly.
I am just wondering why this class is used and by whom?

Thanks.
 
Chris Beckey
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't answer your question specifically...
The VM is required to free all SoftReference references before returning an OutOfMemory exception. You are probably seeing that behavior in the log file. Its doing what it is supposed to but it can't free up enough to satisfy the memory request.

see http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ref/SoftReference.html
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GC tries its best to recover memory before throwing this error.
GC is definately making sure that all the softreferences are resolved before it throws this error.There might be something else in your program which is leading to this error.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Ludmilla]: It looks like there are a lot of soft references to the sun.reflect.GeneratedMethodAccessor class and GC cannot properly clean it. But we don�t use soft references directly. I am just wondering why this class is used and by whom?

I don't know exactly, but it's something using reflection. Does your code use reflection? Perhaps it's your testing framework - e.g. JUnit uses reflection to access each test method. I would think that for every test method, there's a GeneratedMethodAccessor subclass created to access it. After the method completes, that class can become eligible for GC.

What part of the output suggests that GC cannot properly clean the GeneratedMethodAccessor classes? Or that the soft reference are references to that class? Could be completely unrelated, I think. One way or another, you ran out of memory, but I don't see an indication that either the GeneratedMethodAccessor or the soft references are the cause of the problem. They're just among the many things that GC does. I would look for a memory usage profiler to determine what is actually taking up most of the memory at the time of the OOME. Don't assume it has anything to do with soft references or GeneratedMethodAccessor.
[ April 27, 2007: Message edited by: Jim Yingst ]
 
jad yuuu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I think your problem is leaving references to objects inside a cache (Hashtable) or similar structure.. make sure they Value does not have a pointer to the key in the structure.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic