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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Memory Leak in Render
  FAQ FAQ  Forum Search   Register Register  Login Login

Memory Leak in Render

 Post Reply Post Reply
Author
Message
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Topic: Memory Leak in Render
    Posted: 13 Dec 05 at 5:05PM

Using AQtime to profile a simple application I have found that I loose 8 bytes on every call that uses the Renderer. While this sounds like a small amount of memory.. trust me - it adds up. My application needs to run unattended for months, and it could process thousands of pages every day making several calls to the Renderer per page.

 

This is my sample code:

 

 

procedure TForm1.Button2Click(Sender: TObject);

var quickPDF : TiSEDQuickPDF;

begin

      quickPDF := TiSEDQuickPDF.Create;

      quickPDF.UnlockKey( MY_QDPF_KEY );

      quickPDF.LoadFromFile( 'AnyDocument.pdf' );

      try

            // This call uses renderer to get text details

            Memo1.Lines.Text := quickPDF.GetPageText( 3 );

      finally

            quickPDF.Free;

      end;

end;

 

I have found the offending section of code in uPDFRenderer.pas but I don’t know why this code is creating a leak.

 

This function is found at line 1355 of uPDFRenderer.pas

 

  procedure DrawXObject(const ResName: string);

 

Does anybody have any ideas or suggestions?

 

Thanks

Steve

Edited by swb1
Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 13 Dec 05 at 6:37PM

Found it!

Unit:uPDFImageDecoder approx Line:1300

Change From :

procedure TPDFImageDecoder.SetColorManager(
NewColorManager: TPDFColorManager);
begin
  FColorManager := NewColorManager; // << This simply assigns a new object to the pointer for an old object that  can now no longer be freed.
  FPrivateColorManager := False;
end;

Change TO:

procedure TPDFImageDecoder.SetColorManager(
NewColorManager: TPDFColorManager);
begin
  FColorManager.Free
  FColorManager := NewColorManager;
  FPrivateColorManager := False;
end;

That's 10 hours of my life I'll never get back

 

 



Edited by swb1
Back to Top
SuperDave View Drop Down
Team Player
Team Player
Avatar

Joined: 10 Nov 05
Location: United Kingdom
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperDave Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 05 at 4:54AM
Hi Steve,
I am using the renderer too but don't have the source code. Could you please send me your uPDFImageDecoder.dcu file?
Thanks,
Dave
superdave156@yahoo.co.uk
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 05 at 6:21AM
Hi Dave!
Michel will collect the corrections from all users and will offer the dcu-files here in a few days as a download-option.

Merry Christmas and a Happy New Year for all of you.
Cheers,
Ingo

Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 05 at 3:49PM

Dave,

If you can wait for Michel you may be better off.  The only DCU that I have is D7 and I am not well equiped to compile other versions at this time.

If D7 is what you need and you just can't wait, let me know and I will send you the DCU.

Steve

 

 

Back to Top
Michel_K17 View Drop Down
Newbie
Newbie
Avatar
www.exp-systems.com

Joined: 25 Jan 03
Status: Offline
Points: 297
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michel_K17 Quote  Post ReplyReply Direct Link To This Post Posted: 26 Dec 05 at 11:01AM
Just to be clear: I "only" have Delphi 7, so anything I would compile would only be using that version of Delphi. Would that be a problem for those that use D2005/2006?
Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 26 Dec 05 at 11:43AM

DCUs are version specific. If you are using D7 and you do not have source code you must have DCUs that were compiled with D7 the same will hold true for D2005 & D2006.

Supplying multiple versions of the DCUs for the group may prove to be a challenge. While I have several versions of Delphi, I don’t usually have more that one version installed at a time. Even though I bought it, I may never install D2005. I will probably just jump to D2006 when I finally get around to upgrading.

 Steve

 



Edited by swb1
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 26 Dec 05 at 4:51PM
Hi Michel!
I think that's only a problem to users with delphi versions below 7 ;-)
I've d5, d2005 and d2006 installed. ...But 'till now i don't have a source licence ;-)
Cheers,
Ingo

Back to Top
SuperDave View Drop Down
Team Player
Team Player
Avatar

Joined: 10 Nov 05
Location: United Kingdom
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperDave Quote  Post ReplyReply Direct Link To This Post Posted: 31 Dec 05 at 5:24AM
I still have D5 as it does everything I need and because upgrading Delphi (I started at Borland Pascal for Windows on Windows 3.1 in 1991) has been so difficult in the past.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 31 Dec 05 at 9:05AM
Hi Dave,

you can download d2005 for free. The licence is similar to the one from vb express! With the d2005 starter edition you can develope and sell your products as long as you are a single developer (this means a one-man-company).
Cheers,
Ingo

Back to Top
SuperDave View Drop Down
Team Player
Team Player
Avatar

Joined: 10 Nov 05
Location: United Kingdom
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperDave Quote  Post ReplyReply Direct Link To This Post Posted: 01 Jan 06 at 3:54AM
That is interesting Ingo. I will download it. Thanks.
Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 01 Jan 06 at 6:25PM
It tried to find this download and failed. Would you happen to have a link?

Thanks
Wheeley
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 02 Jan 06 at 2:07AM
Hi!
Sorry. "Download" wasn't correct. It was a special borland edition on several magazine cds here in germany in march/april 2005.
Perhaps you can go online to your preferred pc magazines and order an older magazine-versions with d2005?

Cheers,
Ingo

Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 02 Jan 06 at 8:20PM
OK. That explains it. I did see on Borland's site where you could get a key for this version. I'm sorry i missed it. Which magazine was it that you got the version with (if you remember)?

Thanks
Wheeley
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 06 at 2:26AM
Hi Wheeley!

German pc magazins:
"PC Magazin"
"c't"

Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store