Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 669 by
matt.cur...@gmail.com: Memory leak when rendering pages.
https://bugs.chromium.org/p/pdfium/issues/detail?id=669What steps will reproduce the problem?
1. Load the attached PDF into PDFium (Chrome is an easy way to test.)
2. Open Chrome's task manager and identify the starting memory level of the PDF process.
3. Scroll from the top of the PDF all the way to the bottom at a reasonable rate
4. Watch as memory usage increases and does not decrease, even after pages have fallen out of view. Memory is only released when the document is released, not before. This leak also only appears when rendering pages, simply loading a page via FPDF_LoadPage() does not cause the leak.
You can also test this in PDFium itself using the following code - it's in Objective-C, but the idea is pretty much the same in plain C:
----
FPDF_InitLibrary();
NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"pdf_reference-1.7" withExtension:@"pdf"];
FPDF_DOCUMENT document = FPDF_LoadDocument(pdfURL.path.UTF8String, nil);
int pageCount = FPDF_GetPageCount(document);
for(int i = 0; i < pageCount; i++){
FPDF_PAGE page = FPDF_LoadPage(document, i);
FPDF_BITMAP bitmap = FPDFBitmap_Create(500, 500, 1);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, 500, 500, 0, 0);
FPDFBitmap_Destroy(bitmap);
FPDF_ClosePage(page);
}
----
What is the expected output? What do you see instead?
Memory allocated by rendering should *not* remain allocated after the page is closed.
What version of the product are you using? On what operating system?
OSX 10.11.6, Chrome 56.0.2924.87. Also tested with latest PDFium commit 5f2d381028b2c09bd09a843368328155b1399c5e.
Please provide any additional information below.
...
Attachments:
pdf_reference_1-7.pdf 17.5 MB
--
You received this message because:
1. The project was configured to send all issue notifications to this address
You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings