[jira] [Commented] (PDFBOX-4144) Pdf to image conversion not releasing memory after conversion

2018-03-07 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4144:
-

I intend to close this issue unless you can attach 1) the PDF 2) your {{-Xmx}} 
value. You should also try with the [2.0.9 
snapshot|https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.9-SNAPSHOT/]
 because there have been improvements on the memory footprint, that may or may 
not apply to you. As you can see from the two issues I linked, the output from 
{{Runtime.getRuntime().totalMemory()}} is useless because java doesn't do 
garbage collection each time objects aren't used anymore.

 

> Pdf to image conversion not releasing memory after conversion
> -
>
> Key: PDFBOX-4144
> URL: https://issues.apache.org/jira/browse/PDFBOX-4144
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing, Rendering
>Affects Versions: 2.0.8
> Environment: Apache Tomcat/8.0.33, Linux, JDK 1.8  
>Reporter: Sachin Mali
>Priority: Major
>
> I have written a program that accepts pdf and convert it to image. Please see 
> the below code for your reference.
> {code:java}
> ByteArrayInputStream ipStream = new 
> ByteArrayInputStream(document.getFile().getBytes());
> PDDocument documentUploaded = 
> PDDocument.load(ipStream,MemoryUsageSetting.setupTempFileOnly());
>      
>          documentUploaded.setResourceCache(new MyResourceCache());
> //Disabled a resource cache
>  PDFRenderer pdfRenderer = new PDFRenderer(documentUploaded);
>  int pageCounter = 0;
>  for (PDPage page : documentUploaded.getPages())
>  {     
> BufferedImage bim = pdfRenderer.renderImageWithDPI(pageCounter, 
> 300, ImageType.RGB);   
>          pageCounter = pageCounter + 1;
>  
> // Some code here
>    bim.flush();
>            bim = null;
>  }
>  documentUploaded.close();
>  
> {code}
> After/Before conversion i printed heap size used by using 
> Runtime.getRuntime().totalMemory() . Also I checked top command to see 
> percentage of memory used.But in both cases the memory keeps increasing after 
> each conversion and does not release used memory.After tomcat restart I get 
> cleaned memory.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4144) Pdf to image conversion not releasing memory after conversion

2018-03-06 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4144:
-

Please read the related issue I just attached.

> Pdf to image conversion not releasing memory after conversion
> -
>
> Key: PDFBOX-4144
> URL: https://issues.apache.org/jira/browse/PDFBOX-4144
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing, Rendering
>Affects Versions: 2.0.8
> Environment: Apache Tomcat/8.0.33, Linux, JDK 1.8  
>Reporter: Sachin Mali
>Priority: Major
>
> I have written a program that accepts pdf and convert it to image. Please see 
> the below code for your reference.
> {code:java}
> ByteArrayInputStream ipStream = new 
> ByteArrayInputStream(document.getFile().getBytes());
> PDDocument documentUploaded = 
> PDDocument.load(ipStream,MemoryUsageSetting.setupTempFileOnly());
>      
>          documentUploaded.setResourceCache(new MyResourceCache());
> //Disabled a resource cache
>  PDFRenderer pdfRenderer = new PDFRenderer(documentUploaded);
>  int pageCounter = 0;
>  for (PDPage page : documentUploaded.getPages())
>  {     
> BufferedImage bim = pdfRenderer.renderImageWithDPI(pageCounter, 
> 300, ImageType.RGB);   
>          pageCounter = pageCounter + 1;
>  
> // Some code here
>    bim.flush();
>            bim = null;
>  }
>  documentUploaded.close();
>  
> {code}
> After/Before conversion i printed heap size used by using 
> Runtime.getRuntime().totalMemory() . Also I checked top command to see 
> percentage of memory used.But in both cases the memory keeps increasing after 
> each conversion and does not release used memory.After tomcat restart I get 
> cleaned memory.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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