Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Resource problem rendering to PDF

edited August 2012 in General
Hello,

I have some resource problems, when I render reports to PDF:

The PDF generation is an encapsulated method. When I run this method in a VCL Form Application the GDIHandles will be released correctly, but when I run the same method in an ISAPI dll, the GDIHandles will *not* be released and after some calls the DLL crashes with "out of resource" error messages. The allocation of the GDIHandles starts with calling AReport.PrintToDevices

When I try to export a simple, but long report to PDF (in VCL Form Application) I'll get an "out of resources" error as well. It seems that the export to PDF doesn't release the GDI objects after rendering each single page.

I use DelphiXE2 and RB14.06

Regards,
Michael

Comments

  • edited August 2012
    Hello,

    I researched the problem and found a really bad bug! In the method TppPDFRendererCustomText.RenderToPDF a local bitmap is created and never relesed again ... which means, that for every single text element a bitmap is leaved behing!
    I patched the method and added a lBitmap.Free and all my resource problems are gone. Even my test report with 15000 simulated records will not run out of resources again.

    BTW: Why do you create a bitmap in nearly every procedure handling text metrics? Wouldn't it be more efficient that each renderer instance holds a bitmap until the renderer is released?

    Regards,
    Michael

    Am 30.08.2012 09:53, schrieb Michael Schwarzl:
  • edited August 2012
    There is a patch available for RB 14.06 that fixes the memory leak in
    TppPDFRendereCustomText. Registered customers can email support@ and request
    the patch.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.