PdfAddTrueTypeFont OutOfMemory
PdfAddTrueTypeFont OutOfMemory
Hey all,
I'm creating a massive batch of pdfs, and about 6000 in I get an OutOfMemory exception when trying to add a font. This isn't actually a memory issue, and my assumption is that the GDI handles aren't being disposed for the fonts and it's running out of handles. I add three fonts per PDF, and if I comment one of them out I can make it to around 8,000 before the error occurs.
I call PdfEndPdf at the end of every PDF, but is there some other way to dispose of all PDF resources or all GdPictureImaging resources so I can avoid this issue?
I'm creating a massive batch of pdfs, and about 6000 in I get an OutOfMemory exception when trying to add a font. This isn't actually a memory issue, and my assumption is that the GDI handles aren't being disposed for the fonts and it's running out of handles. I add three fonts per PDF, and if I comment one of them out I can make it to around 8,000 before the error occurs.
I call PdfEndPdf at the end of every PDF, but is there some other way to dispose of all PDF resources or all GdPictureImaging resources so I can avoid this issue?
Re: PdfAddTrueTypeFont OutOfMemory
Hi,
I identified a small unreleased GDI resource in this method .
Maybe it is the cause of the problem. The next update, which will be published within 5 days will include the fix.
Kind regards,
Loïc
I identified a small unreleased GDI resource in this method .
Maybe it is the cause of the problem. The next update, which will be published within 5 days will include the fix.
Kind regards,
Loïc
Re: PdfAddTrueTypeFont OutOfMemory
Thanks Loic, I'm not sure why GDI has to be so finnicky.
Re: PdfAddTrueTypeFont OutOfMemory
Is this update still on track for this week?
Re: PdfAddTrueTypeFont OutOfMemory
Hi,
Yes it will be published within 48 hours.
Kind regards,
Loïc
Yes it will be published within 48 hours.
Kind regards,
Loïc
Re: PdfAddTrueTypeFont OutOfMemory
The problem still exists. I don't think the issue is actually with the PdfAddTrueTypeFont method, but with the fact that the font that is added with that method is not disposed with PdfEndPdf. Here is, in short, what I'm doing.
I leak three GDI objects every iteration. My assumption was that PdfEndPdf would deallocate those fonts, but that doesn't seem to be happening. Is there any other way for me to deallocate those resources?
Any help would be appreciated, this is a huge issue for me.
Code: Select all
for (int i = 0; i < paths.Length; i++)
{
int pdf = gdPictureImaging.PdfNewPdf(paths[i]);
int arialBold = gdPictureImaging.PdfAddTrueTypeFont(pdf, "Arial", true, false);
int arialPlain = gdPictureImaging.PdfAddTrueTypeFont(pdf, "Arial", false, false);
int timesNewRoman = gdPictureImaging.PdfAddTrueTypeFont(pdf, "Times New Roman", false, false);
... pdf code...
gdPictureImaging.PdfEndPdf(pdf);
}
Any help would be appreciated, this is a huge issue for me.
Re: PdfAddTrueTypeFont OutOfMemory
Hi,
I am sorry to heard that. Anyway I have finally been able to reproduce the problem. i think it is definitively fixed now.
I will publish an urgent fix tomorrow, if you want a most urgent fix and better follow-up just send us a mail to https://www.gdpicture.com/support/getting-support-from-our-team
Kind regards,
Loïc
I am sorry to heard that. Anyway I have finally been able to reproduce the problem. i think it is definitively fixed now.
I will publish an urgent fix tomorrow, if you want a most urgent fix and better follow-up just send us a mail to https://www.gdpicture.com/support/getting-support-from-our-team
Kind regards,
Loïc
Re: PdfAddTrueTypeFont OutOfMemory
Thanks Loic, tomorrow should be fine. I appreciate the quick response!
Re: PdfAddTrueTypeFont OutOfMemory
Working like a charm now, thanks for the help!
Re: PdfAddTrueTypeFont OutOfMemory
OK perfect,
I made the test with 1.000.000 of documents with 0 byte of memory leak
I made the test with 1.000.000 of documents with 0 byte of memory leak
Who is online
Users browsing this forum: No registered users and 2 guests