pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Or...@beeriprint.co.il>
Subject "OutOfMemoryError: Java heap space" even when using MemoryUsageSetting.setupTempFileOnly()
Date Sun, 28 Aug 2016 08:53:38 GMT

hi
when try to load large pdf files (70000 pages , 70MB size file), I get the "OutOfMemoryError:
Java heap space"
tryed this :

MemoryUsageSetting mus = MemoryUsageSetting.setupTempFileOnly();
PDDocument document = PDDocument.load( file ,mus);

also tryed this :
MemoryUsageSetting mus = MemoryUsageSetting.setupTempFileOnly();
RandomAccessBufferedFileInputStream ra = new RandomAccessBufferedFileInputStream(file);
document = PDDocument.load( ra ,mus);

but in both cases I get this error :

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
                at org.apache.pdfbox.io.ScratchFileBuffer.addPage(ScratchFileBuffer.java:132)
                at org.apache.pdfbox.io.ScratchFileBuffer.<init>(ScratchFileBuffer.java:84)
                at org.apache.pdfbox.io.ScratchFile.createBuffer(ScratchFile.java:403)
                at org.apache.pdfbox.cos.COSStream.createRawOutputStream(COSStream.java:253)
                at org.apache.pdfbox.pdfparser.COSParser.parseCOSStream(COSParser.java:946)
                at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:760)
                at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:721)
                at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:652)
                at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:612)
                at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:215)
                at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:249)
                at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:966)
                at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:885)
                at pdftoimage_pdfbox.PrintBookmarks.main(PrintBookmarks.java:87)
Java HotSpot(TM) Client VM warning: MaxNewSize (512000k) is equal to or greater than the entire
heap (512000k).  A new max generation size of 511936k will be used.
C:\Users\orlev.MANAGEMENT\Documents\NetBeansProjects\PdfToImage_PdfBox\nbproject\build-impl.xml:1039:
The following error occurred while executing this line:


looks like MemoryUsageSetting.setupTempFileOnly() has no affect ?
do I use it incorrectlly ?

** I can overcome this problem with -Xmx1500m but had to increase my physical memory.. , and..,
I have much bigger files (250000 pages)…


thanks!
or.

Thanks,
Or Lev
Maintenance
Beeri print
Israel
orlev@beeriprint.co.il<mailto:orlev@beeriprint.co.il>




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message