On Mar 5, 2007, at 09:51, Abel Braaksma wrote:

Andreas L Delmelle wrote:
AFAICT, it is already parsed with SAX (see org.apache.fop.fonts.FontReader).

Perhaps it is something else then? :S


It doesn't seem like it's those widths by itself that are causing the problem. An array of 50K int-widths should correspond to min. 200K max. 400K of heap. :/

That sounds logical.

You mentioned that the OOMError in Tomcat occurred right after loading the metrics, which would indicate that it's actually what follows that's taking up the memory.

I'm no expert on the font-handling, but browsed around through the related code, and found that at some point the entire TTF file gets read into a byte array
(see org.apache.fop.fonts.truetype.FontFileReader()).

[Note:
If I judge correctly, there is even the possibility that this happens twice? If there is no metrics file, then LazyFont.load() does this first, and later on, an independent FontFileReader() is used by the renderer to embed the font... I'll leave this for others to comment in. Also, FontFileReader.init() transfers the file contents to a byte array but the constructor does not close the InputStream. I wonder if that's intended or an oversight, especially since the other constructor does close the stream?]

Anyway, while this decreases time spent on I/O later on, for such large fonts this does indeed look like a suboptimal approach... especially since ultimately only the used glyphs get embedded in the result. :/


Cheers,

Andreas


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

Reply via email to