SoftReference incorrect javadoc?
david.holmes at oracle.com
Tue Apr 16 02:19:41 UTC 2019
Re-directing to core-libs-dev and hotspot-gc-dev.
On 16/04/2019 12:14 pm, Michael Pollmeier wrote:
>> All soft references to softly-reachable objects are guaranteed to have
> been cleared before the virtual machine throws an OutOfMemoryError
> That statement was true when soft references were first introduced in
> java 1.2, but from java 1.3.1 the jvm property
> `-XX:SoftRefLRUPolicyMSPerMB` was introduced.
> It defaults to 1000 (milliseconds), meaning that if there’s only 10MB
> available heap, the garbage collector will free references that have
> been used more than 10s ago. I.e. everything else (including young
> softly reachable objects) will *not* be freed, leading to an
> OutOfMemoryError, contradicting the above quoted 'guarantee'.
> That's also the behaviour I observed on various JREs. Would you agree,
> i.e. should I propose an updated doc?
More information about the core-libs-dev