[
https://issues.apache.org/jira/browse/PDFBOX-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17005936#comment-17005936
]
Ben Manes commented on PDFBOX-4726:
-----------------------------------
I suppose that is true and would be a good longer term fix.
However, the PDF api encourages us to provide a {{MemoryUsageSetting}}. It is
surprising to find that in memory hungry areas it is not used, and instead one
has to learn the internals to work around memory leaks. Ideally the memory
settings would be inspected more broadly to safeguard the user from these types
of problems. By specifying a disk cache, I'd really love for that to be used
rather than heap for memory hungry operations. It would make the library more
robust and not require expertise from users for (seemingly trivial) operations
like rendering pdfs to images.
> PDFRenderer uses excessive memory
> ---------------------------------
>
> Key: PDFBOX-4726
> URL: https://issues.apache.org/jira/browse/PDFBOX-4726
> Project: PDFBox
> Issue Type: Improvement
> Reporter: Ben Manes
> Priority: Major
> Attachments: heap.png, instance.png, stacktrace.png
>
>
> {{PDFRenderer.renderImage}} uses BufferedImage with only in-memory data. This
> is uncompressed and can use excessive memory. This occurs despite setting
> \{{MemoryUsageSetting}} being configured on the document for disk space,
> which should be honored.
> This [stackoverflow answer|https://stackoverflow.com/a/53205617/19450]
> suggests using a {{WritableRaster}} backed by a temporary file. This change
> cannot be done in user code and requires updating the {{PDFRenderer}}.
> I am currently trying to track down a PDF that caused out-of-memory issues.
> From the heap dump only a few {{BufferedImages}} where in memory, but they
> took 6gb in their uncompressed data.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]