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!
![]() |
Memory leak? |
Post Reply
|
| Author | |
hansmerkl
Beginner
Joined: 05 Feb 11 Location: USA Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Topic: Memory leak?Posted: 05 Feb 11 at 10:22PM |
|
The following C# code runs out of memory with even medium sized files. After calling DACloseFile the memory gets released. Am I missing something that has to be released?
QuickPDFAX0723.PDFLibrary Lib = new QuickPDFAX0723.PDFLibrary(); Lib.UnlockKey("xxxx"); string fnIn = this.buttonEditPDF.Text; int DocHandle = Lib.DAOpenFileReadOnly(fnIn, ""); int PageCount = Lib.DAGetPageCount(DocHandle); for (int i = 0; i < PageCount; i++) { int PageHandle = Lib.DAFindPage(DocHandle, i + 1); int ImageListHandle = Lib.DAGetPageImageList(DocHandle, PageHandle); int ImageCount = Lib.DAGetImageListCount(DocHandle, ImageListHandle); for (int ii = 0; ii < ImageCount; ii++) { var ImageBuffer = Lib.DAGetImageDataToVariant(DocHandle, ImageListHandle, ii + 1); byte[] b = ImageBuffer as byte[]; } } MessageBox.Show("Done"); Lib.DACloseFile(DocHandle); |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Feb 11 at 12:29PM |
|
Hi Hans!
After DACloseFile The "Free" should follow. You can read here sometimes about memory-problems as a result based on DAFindPage. I've an old workaround to avoid this: Using a counter like this (for a loop in a loop) ... QP := TQuickPDF0721.Create; // . . . pc := pc + 1; if ( pc = 5 ) Then begin pc := 0; QP.Free; QP := TQuickPDF0721.Create; // QP.UnlockKey('MyKey...'); // . . . end; // . . . QP.Free; Edited by Ingo - 06 Feb 11 at 12:30PM |
|
![]() |
|
hansmerkl
Beginner
Joined: 05 Feb 11 Location: USA Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Feb 11 at 7:39PM |
|
It's a good idea to close to the file from time to time. I hope the performance won't suffer too much.
I hope QuickPDF are aware of the DAFindPage problem and will fix it soon. |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Feb 11 at 8:15PM |
|
Hi!
The DAFindPage-prob is already an older one and so i don't think that it will be fixed soon ;-) But you can avoid the DA-functions. Use the "normal" ones and with the current library version you won't have any disadvantages. Cheers, Ingo |
|
![]() |
|
hansmerkl
Beginner
Joined: 05 Feb 11 Location: USA Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Feb 11 at 8:27PM |
|
That's probably the way to go.
|
|
![]() |
|
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