xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keiron Liddle <kei...@aftexsw.com>
Subject static/threading problem with SVGFontUtilities
Date Mon, 18 Feb 2002 08:52:56 GMT

I have a couple of problems with the SVGFontUtilities class.

It holds a static reference to the "current" document.
This means that it will hold onto the last document to have text in it. I 
ran into a problem where the document was holding onto a whole lot of 
other stuff through the DefaultSVGContext due to anonymous inner class 
using variables in the outer class.
This appears to be a memory leak of sorts.

The other problem is that the code would appear to not be thread safe. In 
a multi-threaded environment the "current" document will constantly be 
changing and the variable 'fontFamilyMap' will be changed all the time. It 
could also have more than one thread altering the hashmap which would 
cause an exception.
The method is only used in one place that I could find in 

One solution could be to store the 'fontFamilyMap' in the document. No 
static references and only a thread problem if two threads are handling 
the same document which can be solved by making the hashmap synchronized.

Thanks for the good work so far.


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

View raw message