Keiron,

I have entered a Bug in Bugzilla so that we can address the problem 
you reported:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6536

The memory leak is a real concern. 
The multi-thread problem is also a concern, 
but note that Batik is usually not thread safe (e.g., the 
SVG generator is not) in the sense that a single instance of a given 
class cannot be share (usually) among threads and work properly (at 
least, there is no guarantee it will). There are points of
synchronization
where multiple threads are used but not everything is thread safe.

We'll look into fixing both the static reference and the multi-tread
issue.

Cheers,
Vincent.

> 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