Hi,

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 
SVGTextElementBridge.java.

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.

Thanks,
Keiron

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to