Another argument: Why did Chris have an OutOfMemoryError in the first
place that the fix for FixedLengthProperty solved? The OutOfMemoryError
doesn't happen anymore because not so many objects are created to
actually be filling the memory. If the objects in the cache had been
releasable, they would have been released by the GC and Chris wouldn't
have run into the OutOfMemoryError.

On 20.07.2007 14:01:52 Andreas L Delmelle wrote:
> On Jul 20, 2007, at 11:58, Jeremias Maerki wrote:
> 
> >
> > Read again: "Implementation note: The value objects in a  
> > WeakHashMap are
> > held by ordinary strong references." That means that all the object in
> > there can never be released since there never be only a weak reference
> > to the object there.
> 
> Right, but the value objects are not the issue. As long as the key  
> can be released, and the value does not refer directly or indirectly  
> back to the key, there is no problem. What the Javadoc warns about is  
> the situation where value /refers back/ to the key in some way or  
> other: most simple case would be that the value object is composite  
> and has an instance member that is itself the key object. In that  
> case, the entry will never be released, unless the value itself is  
> wrapped in a WeakReference.
> 
> FWIW: I had the same initial reservations, but re-reading the  
> Javadoc, it occurred to me that this was actually no problem at all.
> 
> 
> Cheers
> 
> Andreas



Jeremias Maerki

Reply via email to