> On 17 Mar 2016, at 13:29, George Sexton <[email protected]> wrote: > > I was looking through things on my server and I'm seeing that my application > has about 130 TrueType font files open. I'm running this under Tomcat so the > process is persistent. > > I've dug through the source code a little bit and I can see that > AbstractTTFParser.parseTTF(File ttfFile) explicitly doesn't close the stream. > I'm guessing this is because there's a way to do deferred parsing of the file.
Yes, that’s right. > I looked at o.a.fontbox.util.FontManager as well, and it looks like when it > gets created, it's loading all available truetype fonts and at least getting > the Font Names table to map the font names to the constructed TrueTypeFont > objects. That’s right, though it only does this once and then saves the naming metadata to an on-disk cache. > Is there ever a point when the file input stream could be closed? Is there > some operation performed on TrueTypeFont that would definitively conclude > access to the stream? When we do the scan, we close each font immediately afterwards. If PDFBox then goes on to use that font, we’ll re-open the file and then cache the new font. The cache is a map of SoftReference<T> objects, which get released when the JVM feels like it. But now I’m wondering, when do we close fonts which are dropped from the FontCache? Maybe there’s an issue here… — John > > -- > George Sexton > *MH Software, Inc.* > Voice: 303 438 9585 > http://www.connectdaily.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
