WPCubed Product Support

Possible memory leak in WPDF?

support

I would recommend to use the latest wPDF V3. There is no known Memory leak in wPDF and it was also tested for a use like this.

But the leak can also be somewhere else - The Print also reformats the text by calling WPTools.

Better do NOT create the pdfExport for each individual file - just use one instance and call Print. The loading and unloading of the engine can cause trouble and is inefficient.

#2 ♥ 0
5.1k Views 2 users read 2 min

I have an applicaiton where I am createing many PDF documents in a loop. It works for many iterations (about 800+), but then fails throwing memory errors. Here is the Code:

function TForm1.WriteToPDF(pageIndex: Integer; var fileName: String) : Boolean;
var pdf : TWPPDFExport;
begin
fileName := FormatDateTime('mmddyyhhmmss', now) + '.PDF';
Result := False;
try
pdf := TWPPDFExport.Create(nil);
pdf.DLLName := IncludeTrailingPathDelimiter(ExtractFilePath(Application.exename)) + 'wPDF300A.dll';
pdf.Source := reMerge; // re Merge = TWPRickText
pdf.AutoLaunch := False;
pdf.FontMode := wpEmbedSubsetTrueType_UsedChar;
pdf.FileName := fileName;
pdf.Print;
Result := True;
finally
pdf.Free;
end;
end;

If I comment out the line "pdf.print;", the applicaiton sails throguh with no issues for thousands of iterations.

Am I implementing wrong or is there a defect in PDF.print that possibly was fixed?

I am using Delphi 2010.
WPDF tool version = 3.62
WPDF300A.dll version = 3.54.1.0

Thank you for Info

#1 ♥ 0