You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Cameron McCormack <ca...@aka.mcc.id.au> on 2004/02/06 00:48:08 UTC

SoftDoublyIndexedTable for storing LiveAttributeValues

Hi Thomas.

My implementation of animation is (slowly) progressing.  I noticed just
now a bug in my program where some elements were forgetting their
animated attribute values.  I see that dom.svg.AbstractElement is using
a SoftDoublyIndexedTable to store the (namespace, localName,
LiveAttributeValue) triples.

When you call SVGOMElement.getAnimatedLengthAttribute it creates a new
SVGOMAnimatedLength and stores it in the table if there wasn't one there
already.  It doesn't keep a reference to this value around, though, and
so I guess the garbage collector cleans it up later on because the
SoftDoublyIndexedTable doesn't keep a hard reference to it.

I suggest changing AbstractElement to use DoublyIndexedTable.  I don't
see any obvious memory leak issues there, but maybe there are some that
prompted the use of the soft references in the first place.

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: SoftDoublyIndexedTable for storing LiveAttributeValues

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Thomas DeWeese:
>    I think this is safe, it probably used a soft reference just so the
> live attribute would be GC'ed - since it did not use to hold any
> 'useful' information, it just provided a different interface to the
> DOM attribute.  I'll try and look at it a little closer later on.

I see.  The changes I made were to store the animated value actually in
the LiveAttributeValue object.

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: SoftDoublyIndexedTable for storing LiveAttributeValues

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Cameron,

Cameron McCormack wrote:

> My implementation of animation is (slowly) progressing.  I noticed just
> now a bug in my program where some elements were forgetting their
> animated attribute values.  I see that dom.svg.AbstractElement is using
> a SoftDoublyIndexedTable to store the (namespace, localName,
> LiveAttributeValue) triples.
> 
> When you call SVGOMElement.getAnimatedLengthAttribute it creates a new
> SVGOMAnimatedLength and stores it in the table if there wasn't one there
> already.  It doesn't keep a reference to this value around, though, and
> so I guess the garbage collector cleans it up later on because the
> SoftDoublyIndexedTable doesn't keep a hard reference to it.
> 
> I suggest changing AbstractElement to use DoublyIndexedTable.  I don't
> see any obvious memory leak issues there, but maybe there are some that
> prompted the use of the soft references in the first place.

    I think this is safe, it probably used a soft reference just so the
live attribute would be GC'ed - since it did not use to hold any
'useful' information, it just provided a different interface to the
DOM attribute.  I'll try and look at it a little closer later on.




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org