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?
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.
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.
[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
Joined: May 06, 2007
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.