Print Page | Close Window

How to free memory after ExtractPageText?

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=2406
Printed Date: 13 May 25 at 8:34AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How to free memory after ExtractPageText?
Posted By: Simon Kemp
Subject: How to free memory after ExtractPageText?
Date Posted: 17 Sep 12 at 8:55AM
Hello,

I'm using ExtractPageText from a clarion program - all works very well but I don't know how to release the memory taken-up by the returned string. Any clues on this? Wondering if I need to make an api call of some kind involving address of the string.

Thanks,
Simon




Replies:
Posted By: AndrewC
Date Posted: 17 Sep 12 at 4:10PM
Calling QP.LibraryVersion() should free that large buffer and return a much smaller buffer of 4 bytes.

The DLL always keeps the last string result from the DLL active and the easiest way to free it is to call the DLL again with a function such as LibraryVersion.  This method allows us much more flexibility when working with string buffers.

Andrew.




Posted By: Simon Kemp
Date Posted: 17 Sep 12 at 4:36PM
That is making loads of sense. I'll try soonish and report back.

Should explain that from clarion I can't actually take a "cstring" (null terminated string) as a return value. The workround is to prototype that QuickPDF is returning a long, then reference that address as a cstring. It left me thinking that housekeeping had to happen from my side - dumb of me. And now realise I have to be careful to finish working with my 'pretend cstring' before asking QuickPDF to do anything else.

Thank-you.


Posted By: Simon Kemp
Date Posted: 18 Sep 12 at 6:36AM
Confirmed that quickpdf is tidying-up correctly. My memory leak must be somewhere else...

Thanks for the help,
Simon



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