Print Page | Close Window

OutOfMemoryError while converting PDF

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=3513
Printed Date: 26 Apr 24 at 3:17AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: OutOfMemoryError while converting PDF
Posted By: Seb_Stati
Subject: OutOfMemoryError while converting PDF
Date Posted: 11 Oct 17 at 10:54AM
Hello,

I have a big list of PDF files to convert into .jpg files.

But at the end of a certain number of conversions, it doesnt work anymore, and I have only OutOfMemory Errors.

This is how I convert my files : 

PDFLibrary->LoadFromFile(filename.c_str(), L"");
nbPages = PDFLibrary->PageCount();
PDFLibrary->RenderDocumentToFile(300, 1, nbPages, 1, cible.c_str());

Am I missing something ? Any way to clear memory ?

Thanks



Replies:
Posted By: tfrost
Date Posted: 11 Oct 17 at 11:31AM
Do you create PDFLibrary at the start of each conversion, and Free it afterwards?  If not, that is an obvious thing to try first, and is the pattern I have always used. There may be no huge 'memory leak' in the library, but what you describe may still result from fragmentation if some of the fields of the library object remain in use throughout.


Posted By: Ingo
Date Posted: 11 Oct 17 at 1:38PM
Hi Sebastian,

like tfrost said already:
The "Free" is what you need ;-)

Here's a "Hello World" for the first steps:
http://www.quickpdflibrary.com/tutorials/delphi/hello-world.php
After create and unlock you have to insert your loadfromfile and the very last thing should be always a free.

If there are still memory lacks.
You can stop after a bunch of pages...
Keep the actual page number in mind...
Doing the Free...
Start with a new Create/Unlock/LoadFromFile...
Begin again with the same file but the last page number...

Cheers and welcome here,
Ingo

BTW:
The starting point for help is here:
http://www.quickpdf.org/



-------------
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