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

liu edited comment on PDFBOX-5530 at 10/20/22 7:47 AM:
-------------------------------------------------------

a simple demo:

-Xmx500M
-Xms500M
-XX:+PrintGCDetails
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=D:\fcs\test

public static void main(String[] args) throws IOException {
                File file = new File("C:/Users/LYCIT/Desktop/需求/引起宕机.pdf");

                try (PDDocument load = PDDocument.load(file, 
MemoryUsageSetting.setupTempFileOnly(-1)
                                .setTempDir(new File("D:\\fcs\\test")))) {


                        try {
                                Thread.sleep(6000000);
                        } catch (InterruptedException e) {
                                e.printStackTrace();
                        }

                } catch (Exception e) {
                        System.out.println(e);
                }
        }


was (Author: JIRAUSER297279):
a simple demo:

-Xmx500M
-Xms500M
-XX:+PrintGCDetails
-XX:MaxTenuringThreshold=15
-XX:PretenureSizeThreshold=100M
-XX:-UseAdaptiveSizePolicy
-XX:MetaspaceSize=128m
-XX:NewRatio=1
-XX:SurvivorRatio=1
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=D:\fcs\test

public static void main(String[] args) throws IOException {
                File file = new File("C:/Users/LYCIT/Desktop/需求/引起宕机.pdf");

                try (PDDocument load = PDDocument.load(file, 
MemoryUsageSetting.setupTempFileOnly(-1)
                                .setTempDir(new File("D:\\fcs\\test")))) {


                        try {
                                Thread.sleep(6000000);
                        } catch (InterruptedException e) {
                                e.printStackTrace();
                        }

                } catch (Exception e) {
                        System.out.println(e);
                }
        }

> Java heap space
> ---------------
>
>                 Key: PDFBOX-5530
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5530
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.25
>            Reporter: liu
>            Priority: Blocker
>         Attachments: image-2022-10-20-14-30-19-790.png, 
> image-2022-10-20-14-30-57-332.png, image-2022-10-20-14-32-10-258.png, 
> image-2022-10-20-15-01-06-688.png, 引起宕机-1.pdf, 引起宕机.pdf
>
>
> code(only this part of the code):
> PDDocument load = PDDocument.load(file, 
> MemoryUsageSetting.setupTempFileOnly(-1);
>  
> hi. Why do I configure it like this, it still takes up so much memory? What 
> is the effect of using setupTempFileOnly. 
> !image-2022-10-20-14-30-19-790.png!
> !image-2022-10-20-14-30-57-332.png!
> !image-2022-10-20-14-32-10-258.png!
> [^引起宕机.pdf]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to