Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
RenderPageToString: How to free result memory |
Post Reply |
Author | |
kmsb12
Beginner Joined: 05 Aug 13 Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 05 Aug 13 at 2:16PM |
I am using the RenderPageToString and the DARenderPageToString functions of the Quickpdf library.
Those functions return me a pointer to char (char*) to the rendering results. The memory holding the result data will not be freed until I call RenderPageToString again. The memory will not be cleaned up when I call DACloseFile either. I found out that I can call DARenderPageToString with an invalid pageRef (0 for instance). The memory from the last rendered page is cleaned up and no new memory will be reserved for the next page rendering. My question now: Is there any official function for cleaning up memory and invalidating the render results or do I have to live with my workaround? Thanks a lot. Kristoff |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Kristoff!
I think you'll need the FREE ;-) Another hint: Don't mix (never!) DA... and non-DA-functions! Inside a try...create...finally...free...end you should use DA... or non-DA but never both! This you can read in the online-references, too ;-) Cheers and welcome here, Ingo |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Kristoff, Andrew.
|
|
kmsb12
Beginner Joined: 05 Aug 13 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Thanks for your answers!
QP.LibraryVersion did not work for me. I now free the library with delete (I am using the C++ wrapper of the library) |
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
Are you absolutely certain that your main program and the DLL use a common allocator and common memory pools, and always will in future? Allocating and freeing memory on opposite sides of a DLL boundary is normally a recipe for subtle problems which hit you long after the event, when the pool is next used.
|
|
kmsb12
Beginner Joined: 05 Aug 13 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
To clearify, I do not delete the memory block holding the pixel data directly. I tried that too, but it did not work Instead I delete the whole library object. DebenuPDFLibraryDLL0914 *pdfLib = new DebenuPDFLibraryDLL0914(...); ... // do whatever with pdfLib ... delete pdfLib; By doing this, I have to recreate the library object again every time after destroying it. But that's OK. As I use the DA... (direct access) methods, I do not need to reload the whole PDF file as I instantiate the pdf library.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store