*
The moose likes Performance and the fly likes OutOfMemory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "OutOfMemory" Watch "OutOfMemory" New topic
Author

OutOfMemory

Ludmila Snova
Greenhorn

Joined: Aug 31, 2006
Posts: 20
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

Joined: Jun 09, 2006
Posts: 116

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

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[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 ]

"I'm not back." - Bill Harding, Twister
jad yuuu
Greenhorn

Joined: May 06, 2007
Posts: 8
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: OutOfMemory