You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Michael Klink (Jira)" <ji...@apache.org> on 2021/06/17 11:43:00 UTC

[jira] [Commented] (PDFBOX-5218) PDF to Image, Why is the larger the heap memory setting, the larger the parsing footprint

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

Michael Klink commented on PDFBOX-5218:
---------------------------------------

Your PDF link requires some kind of login.

That being said, how do you determine the footprint?

You are aware that in setups with more memory available garbage collection may kick in later, making more memory appear to be in use?

> PDF to Image, Why is the larger the heap memory setting, the larger the parsing footprint
> -----------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5218
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5218
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 2.0.24
>         Environment: jdk1.8
> windows 10
> linux
> macOS
>            Reporter: lanshiqin
>            Priority: Major
>
> Why is the larger the heap memory setting, the larger the parsing footprint
> -Xmx8g, Use 4g at most
> -Xmx1g, Use 600MB at most
> It is bug?
> [PDF File|https://gitee.com/lanshiqin/web-demo/raw/master/src/main/resources/static/Max_PDF_DEMO.pdf]
>  
> {code:java}
> public class Demo {
>     public static void main(String[] args) throws Exception {
>         String pdfUrl = "file:///D:\\xxxx.pdf";
>         InputStream in = new URL(pdfUrl).openStream();
>         PDDocument document = PDDocument.load(in, MemoryUsageSetting.setupTempFileOnly());
>         document.setResourceCache(null);
>         PDFRenderer renderer = new PDFRenderer(document);
>         renderer.setSubsamplingAllowed(true);
>         for (int i = 0; i < document.getNumberOfPages(); i++) {
>             BufferedImage bufferedImage = renderer.renderImageWithDPI(i, 100);
>             try {
>                 System.out.println("current is : " + i);
>             } finally {
>                 bufferedImage.getGraphics().dispose();
>             }
>         }
>         document.close();
>         in.close();
>     }
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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