You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Joel Hirsh <jo...@gmail.com> on 2015/11/23 20:14:48 UTC

Problem with "GC overhead limit exceeded" on Mac

I am finding that the font initialization code is frequently getting this
error on the Mac

According to Sun, the error happens "if too much time is being spent in
garbage collection: if more than 98% of the total time is spent in garbage
collection and less than 2% of the heap is recovered, an OutOfMemoryError
will be thrown.".  Seems to be a result of too many small objects combined
with a not so fast computer.

java.lang.OutOfMemoryError: GC overhead limit exceeded
 at org.apache.fontbox.cff.IndexData.getBytes(IndexData.java:44)
 at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:437)
 at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:115)
 at org.apache.fontbox.ttf.CFFTable.read(CFFTable.java:53)
 at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
 at org.apache.fontbox.ttf.OpenTypeFont.getCFF(OpenTypeFont.java:61)
 at
org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFontImpl(FileSystemFontProvider.java:432)
 at
org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:344)
 at
org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:243)
 at
org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:224)
 at
org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:132)
 at
org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:151)
 at
org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:415)
 at
org.apache.pdfbox.pdmodel.font.FontMapperImpl.getTrueTypeFont(FontMapperImpl.java:323)
 at
org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:196)
 at
org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75)
 at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123)
 at
org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
 at
org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:814)
 at
org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:471)
 at
org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:445)
 at
org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
 at
org.apache.pdfbox.text.PDFTextStreamEngine.processPage(PDFTextStreamEngine.java:117)
 at
org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:370)
 at
org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:307)
 at
org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:252)

Any suggestions on how to deal with this?

Re: Problem with "GC overhead limit exceeded" on Mac

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 24.11.2015 um 03:16 schrieb Joel Hirsh:
> Sorry, what I meant by frequently is that it happens on a number of Mac's.
> So far, it appears to not happen on faster Macs with more memory, but on
> slower ones with less memory.  But on the systems it happens on, its 100%
> of the time.  I've seen some discussions about this error that indicate it
> can be a result of many small objects that need to be garbage collected.
>
> I have noticed that version 2 takes a few seconds to initialize even on
> even the fastest systems I have tried it on and am wondering if there is
> something happening that could be made more efficient.

No, this is meant to be run once, or when the list of fonts have 
changed. You could remove fonts and it would be faster.

On those macs where it happens always, does it change if you increase 
-Xmx memory?

Is there any log output besides the exception?

However.... you didn't read my text at all. The very first question, 
which was "Are you using the latest version?" Because I see you're not:


org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:344)


that location only existed until the version of 23.10.2015. On 5.11.2015 
this was changed, for the very reason you mention (high memory usage).

Tilman

>
> On Mon, Nov 23, 2015 at 2:29 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Are you using the latest version (RC2)?
>>
>> You mention that this happens "frequently". In theory, this should be
>> called only once, i.e. when new fonts are discovered. Did you delete the
>> .pdfbox.cache file to provoke this?
>>
>> Tilman
>>
>>
>> Am 23.11.2015 um 20:14 schrieb Joel Hirsh:
>>
>>> I am finding that the font initialization code is frequently getting this
>>> error on the Mac
>>>
>>> According to Sun, the error happens "if too much time is being spent in
>>> garbage collection: if more than 98% of the total time is spent in garbage
>>> collection and less than 2% of the heap is recovered, an OutOfMemoryError
>>> will be thrown.".  Seems to be a result of too many small objects combined
>>> with a not so fast computer.
>>>
>>> java.lang.OutOfMemoryError: GC overhead limit exceeded
>>>    at org.apache.fontbox.cff.IndexData.getBytes(IndexData.java:44)
>>>    at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:437)
>>>    at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:115)
>>>    at org.apache.fontbox.ttf.CFFTable.read(CFFTable.java:53)
>>>    at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
>>>    at org.apache.fontbox.ttf.OpenTypeFont.getCFF(OpenTypeFont.java:61)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFontImpl(FileSystemFontProvider.java:432)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:344)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:243)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:224)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:132)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:151)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:415)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.FontMapperImpl.getTrueTypeFont(FontMapperImpl.java:323)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:196)
>>>    at
>>>
>>> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75)
>>>    at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123)
>>>    at
>>>
>>> org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
>>>    at
>>>
>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:814)
>>>    at
>>>
>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:471)
>>>    at
>>>
>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:445)
>>>    at
>>>
>>> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
>>>    at
>>>
>>> org.apache.pdfbox.text.PDFTextStreamEngine.processPage(PDFTextStreamEngine.java:117)
>>>    at
>>>
>>> org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:370)
>>>    at
>>>
>>> org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:307)
>>>    at
>>> org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:252)
>>>
>>> Any suggestions on how to deal with this?
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


Re: Problem with "GC overhead limit exceeded" on Mac

Posted by Joel Hirsh <jo...@gmail.com>.
Sorry, what I meant by frequently is that it happens on a number of Mac's.
So far, it appears to not happen on faster Macs with more memory, but on
slower ones with less memory.  But on the systems it happens on, its 100%
of the time.  I've seen some discussions about this error that indicate it
can be a result of many small objects that need to be garbage collected.

I have noticed that version 2 takes a few seconds to initialize even on
even the fastest systems I have tried it on and am wondering if there is
something happening that could be made more efficient.

On Mon, Nov 23, 2015 at 2:29 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Are you using the latest version (RC2)?
>
> You mention that this happens "frequently". In theory, this should be
> called only once, i.e. when new fonts are discovered. Did you delete the
> .pdfbox.cache file to provoke this?
>
> Tilman
>
>
> Am 23.11.2015 um 20:14 schrieb Joel Hirsh:
>
>> I am finding that the font initialization code is frequently getting this
>> error on the Mac
>>
>> According to Sun, the error happens "if too much time is being spent in
>> garbage collection: if more than 98% of the total time is spent in garbage
>> collection and less than 2% of the heap is recovered, an OutOfMemoryError
>> will be thrown.".  Seems to be a result of too many small objects combined
>> with a not so fast computer.
>>
>> java.lang.OutOfMemoryError: GC overhead limit exceeded
>>   at org.apache.fontbox.cff.IndexData.getBytes(IndexData.java:44)
>>   at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:437)
>>   at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:115)
>>   at org.apache.fontbox.ttf.CFFTable.read(CFFTable.java:53)
>>   at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
>>   at org.apache.fontbox.ttf.OpenTypeFont.getCFF(OpenTypeFont.java:61)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFontImpl(FileSystemFontProvider.java:432)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:344)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:243)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:224)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:132)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:151)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:415)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.FontMapperImpl.getTrueTypeFont(FontMapperImpl.java:323)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:196)
>>   at
>>
>> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75)
>>   at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123)
>>   at
>>
>> org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
>>   at
>>
>> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:814)
>>   at
>>
>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:471)
>>   at
>>
>> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:445)
>>   at
>>
>> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
>>   at
>>
>> org.apache.pdfbox.text.PDFTextStreamEngine.processPage(PDFTextStreamEngine.java:117)
>>   at
>>
>> org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:370)
>>   at
>>
>> org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:307)
>>   at
>> org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:252)
>>
>> Any suggestions on how to deal with this?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Problem with "GC overhead limit exceeded" on Mac

Posted by Tilman Hausherr <TH...@t-online.de>.
Are you using the latest version (RC2)?

You mention that this happens "frequently". In theory, this should be 
called only once, i.e. when new fonts are discovered. Did you delete the 
.pdfbox.cache file to provoke this?

Tilman

Am 23.11.2015 um 20:14 schrieb Joel Hirsh:
> I am finding that the font initialization code is frequently getting this
> error on the Mac
>
> According to Sun, the error happens "if too much time is being spent in
> garbage collection: if more than 98% of the total time is spent in garbage
> collection and less than 2% of the heap is recovered, an OutOfMemoryError
> will be thrown.".  Seems to be a result of too many small objects combined
> with a not so fast computer.
>
> java.lang.OutOfMemoryError: GC overhead limit exceeded
>   at org.apache.fontbox.cff.IndexData.getBytes(IndexData.java:44)
>   at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:437)
>   at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:115)
>   at org.apache.fontbox.ttf.CFFTable.read(CFFTable.java:53)
>   at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
>   at org.apache.fontbox.ttf.OpenTypeFont.getCFF(OpenTypeFont.java:61)
>   at
> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeFontImpl(FileSystemFontProvider.java:432)
>   at
> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.addTrueTypeCollection(FileSystemFontProvider.java:344)
>   at
> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.scanFonts(FileSystemFontProvider.java:243)
>   at
> org.apache.pdfbox.pdmodel.font.FileSystemFontProvider.<init>(FileSystemFontProvider.java:224)
>   at
> org.apache.pdfbox.pdmodel.font.FontMapperImpl$DefaultFontProvider.<clinit>(FontMapperImpl.java:132)
>   at
> org.apache.pdfbox.pdmodel.font.FontMapperImpl.getProvider(FontMapperImpl.java:151)
>   at
> org.apache.pdfbox.pdmodel.font.FontMapperImpl.findFont(FontMapperImpl.java:415)
>   at
> org.apache.pdfbox.pdmodel.font.FontMapperImpl.getTrueTypeFont(FontMapperImpl.java:323)
>   at
> org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:196)
>   at
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:75)
>   at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123)
>   at
> org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
>   at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:814)
>   at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:471)
>   at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:445)
>   at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
>   at
> org.apache.pdfbox.text.PDFTextStreamEngine.processPage(PDFTextStreamEngine.java:117)
>   at
> org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:370)
>   at
> org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:307)
>   at
> org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:252)
>
> Any suggestions on how to deal with this?
>


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