Troublesome reflection-cached SoftReferences
Y. Srinivas Ramakrishna
Y.S.Ramakrishna at Sun.COM
Fri Apr 24 10:04:41 UTC 2009
Charles Oliver Nutter wrote:
>> In any event, the JVM spec guarantees that all soft refs that are not
>> strongly reachable
>> will be cleared before an OOM is issued., I trust your issue is one
>> of performance badness
>> on account of a large heap, not an OOM?
> Actually it is an OOM problem.
If it is an OOM problem we can ignore discussion of how to more
aggressively clear the soft ref, since that is
in some sense moot.
> The problem is that on repeated redeploys, the memory continues to
> grow because these SoftReferences are holding on to a large graph of
> data. Some of this data holds also to class references, and so rather
> than getting a general heap OOM we get a PermGen OOM. Should a PermGen
> OOM force softly-reachable objects to be collected as well?
Yes, each and every softly reachable object should be collected before
any kind of OOM (whether in perm or in regular heap) is thrown.
Have you made sure your soft ref's referent is not strongly reachable?
BTW, -XX:+PrintReferenceGC will give some stats on Reference object
processing. If you run a debug JVM then -XX:+TraceReferenceGC will give
(altogether too much) tracing info as References are processes by GC,
hotspot-gc-use mailing list
hotspot-gc-use at openjdk.java.net
More information about the hotspot-gc-dev