On 20.07.2007 11:52:15 Andreas L Delmelle wrote:
> On Jul 20, 2007, at 11:19, Jeremias Maerki wrote:
> 
> >>
> >> The initial profile shows that instances of WeakHashMap$entry and
> >> org.apache.fop.fo.properties.FixedLength continually grow with the  
> >> life
> >> of JVM.
> >
> > Interesting coincidence:
> > That's exactly what Andreas already wrote about in the other thread
> > about the property cache: The values of the WeakHashMap must not
> > reference objects (or be the same objects) as used in the keys. See
> > javadoc:
> 
> Interesting interpretation, but that's not what the Javadoc says, if  
> I interpret correctly:
> While "care should be taken to ensure that value objects do not  
> strongly refer to their own keys", there seems to be nothing against  
> the values being the same objects as the keys. Identity implies no  
> reference.
> 
> As long as the value-objects do not contain a member that points to  
> the key, we should be safe.

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.

> > In addition to that there was a bug in FixedLength.equals() that made
> > the caching effect-less:
> > http://svn.apache.org/viewvc?view=rev&rev=557934
> 
> That was the most likely cause. The equals() method returning false  
> because of this, would keep on creating separate instances.
> How they would be leaked into a subsequent run is not quite clear to  
> me, though...

Because of the bug in PropertyCache. The two bugs just add to each other.

Jeremias Maerki

Reply via email to