xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hardy <vincent.ha...@sun.com>
Subject Re: static/threading problem with SVGFontUtilities
Date Tue, 19 Feb 2002 10:03:24 GMT

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


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
where multiple threads are used but not everything is thread safe.

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


> 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: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org

View raw message