[ https://issues.apache.org/jira/browse/PDFBOX-2688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ankit Khanal updated PDFBOX-2688: --------------------------------- Affects Version/s: 1.8.7 > sun.java2d.Disposer leak when using pdf to image conversion in a > server(tomcat) > ------------------------------------------------------------------------------- > > Key: PDFBOX-2688 > URL: https://issues.apache.org/jira/browse/PDFBOX-2688 > Project: PDFBox > Issue Type: Bug > Affects Versions: 1.8.8 > Reporter: Ankit Khanal > > I am running with 6GB of heap space and running PDF to PNG conversion in a > servlet container(tomcat). This happens only when running thousands of > requests for conversion. > JVM memory statistics shows heap space never going above 1GB and non-heap > memory is also constant but the linux process or windows process seems to > consume around 8GB of memory. > Heap dump shows that the largest object is sun.java2d.Disposer and is around > 200MB. > It seems that the leaked memory is native memory used by java2d and not > accounted in the heap memory statistic but this growth of sun.java2d.Disposer > memory is proportional to the growth of process memory(linux 'top' command). > BufferedImage image = null; > ByteArrayInputStream pdfStream = getpdfbytesfromExistingDoc(); > PDDocument document = null; > PDPage page = null; > COSDocument cosDoc = null; > PDFParser parser = null; > try { > parser = new PDFParser(pdfStream); > parser.parse(); > cosDoc = parser.getDocument(); > document = new PDDocument(cosDoc); > @SuppressWarnings("unchecked") > List<PDPage> pages = > document.getDocumentCatalog().getAllPages(); > page = pages.get(0); > int imageType = BufferedImage.TYPE_INT_ARGB; > image = page.convertToImage(imageType, 72); > } finally { > if (cosDoc != null) { > cosDoc.close(); > } > if (parser != null) { > parser.clearResources(); > } > if (document != null) { > if (page != null) { > page.clear(); > } > document.close(); > } > } > return image; > } -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org