Bug 33607

Summary: Font file leakage, caching suggested
Product: Batik - Now in Jira Reporter: M <mru>
Component: SVG RasterizerAssignee: Batik Developer's Mailing list <batik-dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 1.8   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description M 2005-02-16 15:07:11 UTC
From batik-users mailing list:

> I'm using Batik to dynamically generate and rasterize some graphics
> from a tomcat servlet.  I supply my own truetype font to make sure the
> correct font gets used.
>
> The problem is that something, presumably Batik, is copying this font
> file to a temporary file (in the tomcat temp directory), and fails to
> remove it.  Over time, I get hundreds of copies of the same file there
> (with names like +~JF4554.tmp), and have to delete them manually.

    I'm fairly certain that it is not Batik, we use Font.createFont
which takes an InputStream.  I would suspect that this method is
copying the file so it can use some sort of native library to read
the font...  Not that this helps you, I'm just "passing the buck" to
the JVM :)

> Am I doing something wrong?  I am certain that I am not telling anyone
> to do the copying, so I can't see how to make file go away when not
> needed.

    I have two suggestions.
[snip]
	2) Add a font cache similar to our Image cache into Batik.
This way as long as the same URL was used each time for the font, you
would only create one instance of the font.  This would probably make
a minor speed improvement.  I could point out the places where changes
would need to be made (I don't think this would be difficult).

     Even if you decide to go with #1 for now could you file a Bugzilla
requesting #2 so it's not forgotten (I think it's a good idea).
Comment 1 Thomas Deweese 2005-03-04 12:16:11 UTC
There is a report that this problem is fixed with JDK 1.5.
Comment 2 Thomas Deweese 2005-03-22 12:16:24 UTC
Reassigning all open bugs to the development list.
Sorry for the mass mailing.