Troublesome reflection-cached SoftReferences

Charles Oliver Nutter charles.nutter at sun.com
Fri Apr 24 08:38:20 PDT 2009


Charles Oliver Nutter wrote:
> The SoftReference appears to be part of the root set, and holds only an 
> array of Constructor objects. Given a bit of time, this reference is 
> cleared and the graph goes with it. But doing repeated redeploys of a 
> JRuby application can fill up the heap before those soft references get 
> a chance to clear.

Here's a screenshot of the SoftReference and its contents, leading up to 
a JRuby "RubyClass" instance which causes things to stay alive. This is 
using a HeapAnalysis tool I found on IBM alphaworks:

http://www.alphaworks.ibm.com/tech/heapanalyzer

Using this tool against a jmap dump, I look at the root set and see a 
SoftReference holding a Constructor[]. This appears to also happen for 
several SoftReferences for other types of reflected information like 
Methods and Fields. Walking down the heap I see these all referencing 
JRuby classes, but I never see the array they contain get collected.

I'm more than happy to put a heap dump somewhere and try anything. At 
this point I just don't know how to fix this reflection issue (if this 
is actually the issue) or how to find out what's actually keeping all my 
objects alive.

- Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 2.png
Type: image/png
Size: 68967 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20090424/1c2b28c4/attachment.png 


More information about the hotspot-gc-use mailing list