Print Page | Close Window

PDfium memory consumption

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3802
Printed Date: 29 Apr 24 at 5:28PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: PDfium memory consumption
Posted By: pdfuserxx
Subject: PDfium memory consumption
Date Posted: 10 Apr 20 at 9:53AM
I'm using PDFium renderer in my project

  var result = newPdfLibrary.SetPDFiumFileName(libraryFileName);
            if (result == 1)
            {
                int renderId = newPdfLibrary.SelectRenderer(4);
            }

and then RenderPageToString to render pdf document, but this results in huge memory consumption which is never released.

Do I need to call anything else to free the memmory?
DestroyRenderer and ReleaseLibrary have no effect.

regards




Replies:
Posted By: Ingo
Date Posted: 10 Apr 20 at 2:33PM
Hi,

regarding the instance the library itself offers "free"...


-------------
Cheers,
Ingo



Posted By: pdfuserxx
Date Posted: 16 Apr 20 at 6:54AM
I'm already calling "ReleaseLibrary" which calls DPLReleaseLibrary and FreeLibrary but the memory is not being released.

regards 


Posted By: Ingo
Date Posted: 16 Apr 20 at 8:03AM
If it's a QuickPDF-issue:

QuickPDF 16 and newer reduced memory consumption down to half.
How big (pages) are your pdf-files?
What's always better for bigger files is using the DA-functionality (but never mix DA- and Non-DA-functions).

Here's a kb-document about how to use an external renderer:
https://www.debenu.com/kb/use-rendering-printing-add-debenu-quick-pdf-library/

I think more that it's a PDFium-issue itself:

Try Google with "PDFium release memory"...
There's a lot.



-------------
Cheers,
Ingo



Posted By: pdfuserxx
Date Posted: 16 Apr 20 at 9:13AM
The page size is 3x2 inch and the file itself is approx 50 kb, but similar results can be observed with other pdf files. 
Sorry for the question, but what is DA functionality?

May be but, I can only access PDFium functionality thru PDF functions. I'm using PDfium, because there ware same issues with default renderer. 

regards


Posted By: Ingo
Date Posted: 16 Apr 20 at 10:38AM
This small pdf won't be responsible for great memory consumption.
I don't know your dev.language and you don't post the real code but if you've free the library itself the problem can only be the PDFium-handling itself.

About DA-functionality:
You're registered here for more than four years now and don't know the online resources?!

Here for a common start:
http://www.quickpdf.org/

Here to read about the direct access functionality (DA):
https://www.debenu.com/docs/pdf_library_reference/FunctionGroups.php

Here to search about anything regarding QuickPDF:
https://www.debenu.com/docs/pdf_library_reference/Search.php

Here you can choose your developer-guide:
https://www.debenu.com/products/development/debenu-pdf-library/help/developer-guide/




-------------
Cheers,
Ingo



Posted By: Ingo
Date Posted: 16 Apr 20 at 10:45AM
In the developer guide you should read the chapter:
Memory and direct access functions



-------------
Cheers,
Ingo



Posted By: pdfuserxx
Date Posted: 17 Apr 20 at 9:59AM
I'm using c#and usng debenu to convert pdf document to png , most of the files consist from single page.
DA functions are not used as the application is working with in memory streams.

The code is fairly simple:

dynamic newPdfLibrary = new DebenuPDFLibraryDLL1711.PDFLibrary(librarypath);  
newPdfLibrary.SetPDFiumFileName(pdfiumdllpath);
newPdfLibrary.SelectRenderer(4)

//load the document from memory stream
pdfLibrary.LoadFromString(ms.ToArray(), string.Empty) 
//select the document 
int documentID = pdfLibrary.SelectedDocument();
//render 
pdfLibrary.RenderPageToString(300, 1, 0);

//cleanup
pdfLibrary.RemoveDocument(documentID);
pdfLibrary.DestroyRenderer();
pdfLibrary.ReleaseLibrary();
pdfLibrary = null;

The problem is in RenderPageToString which calls DPLRenderPageToString where the memory leak occurs.

regards


Posted By: Ingo
Date Posted: 17 Apr 20 at 10:10AM
"...
The problem is in RenderPageToString which calls DPLRenderPageToString where the memory leak occurs.
..."

and the render-function calls PDFium inside.
Again: Try Google regarding memory consumption by PDFium.
You can check it very easily if it's PDFium or the QP-function:
Change your code and kick off PDFium - what's the result now... better?

If you won't succeed with your trys you should ask the publishers of the library via the official support page.



-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk