You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2016/05/02 10:12:12 UTC

[jira] [Comment Edited] (PDFBOX-3334) TrueType fonts memory leak

    [ https://issues.apache.org/jira/browse/PDFBOX-3334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15266200#comment-15266200 ] 

Tilman Hausherr edited comment on PDFBOX-3334 at 5/2/16 8:11 AM:
-----------------------------------------------------------------

I tried the same now, opened and rendered the file 10x but only one ttf remains. That one is the Helvetica font from page 2, which is a standard 14 font. (See line 76 of PDType1Font.java, these are static and the actual font loaded depends on the system).

I have a theory... see this code in TrueTypeCollection.java
{code}
    public TrueTypeFont getFontByName(String name) throws IOException
    {
        for (int i = 0; i < numFonts; i++)
        {
            TrueTypeFont font = getFontAtIndex(i);
            if (font.getName().equals(name))
            {
                return font;
            }
            // font not closed
        }
        return null;
    }
{code}
the TT font is not closed if it doesn't match.

Could you look at your .pdfbox.cache file in your user directory, to see whether Helvetica or Arial is a part of a .ttc file?


was (Author: tilman):
I tried the same now, opened and rendered the file 10x but only one ttf remains. That one is the Helvetica font from page 2, which is a standard 14 font. (See line 76 of PDType1Font.java, these are static and the actual font loaded depends on the system).

I have a theory... see this code in TrueTypeCollection.java
{code}
    public TrueTypeFont getFontByName(String name) throws IOException
    {
        for (int i = 0; i < numFonts; i++)
        {
            TrueTypeFont font = getFontAtIndex(i);
            if (font.getName().equals(name))
            {
                return font;
            }
        }
        return null;
    }
{code}
the TT font is not closed if it doesn't match.

Could you look at your .pdfbox.cache file in your user directory, to see whether Helvetica or Arial is a part of a .ttc file?

> TrueType fonts memory leak
> --------------------------
>
>                 Key: PDFBOX-3334
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3334
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.1
>            Reporter: Juraj Lonc
>         Attachments: screenshot-1.png, skusenosti-z-implementacie-a-prevadzky-systemu_roman-pavco.pdf
>
>
> I open this PDF document, read all pages and render to images, close document.
> After running GC there are still TrueTypeFont objects in memory.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org