Large PDF Memory Issues (OutOfMemoryException)

Discussions about PDF management.
Post Reply
payne296
Posts: 22
Joined: Wed Jul 07, 2010 5:25 pm

Large PDF Memory Issues (OutOfMemoryException)

Post by payne296 » Fri Jul 22, 2011 6:26 am

Hi all,

I'm having issues with the PDF plugin throwing OutOfMemory exceptions (this issue also existed in v7). I'm trying to create 10 PDFs, 2000 - 3000 pages each. The first five or six finish correctly, but during the seventh I run out of memory. (I am calling pdf.CloseDocument() after I call pdf.SaveToFile(), which does free up most of the memory).

I ran the ANTS memory profiler over the application and think I've identified the issue. Every time a page is created using pdf.AddImageFromGdPictureImage(...) a string reference is made to the image's cached bitmap. That makes sense, but apparently those strings are stored statically, because calling pdf.CloseDocument() does not release them from memory (I've attached a screenshot of the memory profiler, titled "strings.png").
strings.png
Strings statically stored by GdPicturePDF
I'm sure this usually doesn't matter, but when creating PDFs with thousands of pages those strings become expensive, and they're useless after the document is closed. Is there any way you guys can alter pdf.CloseDocument() to dereference them?

I've also attached a value dump of the string's static parent object. Obviously the other members of this class also hurt the memory consumption, but the string member if far more expensive than any other member in the class).
string parent.png
The obfuscated parent class of the bitmap location string.
string parent.png (12.17 KiB) Viewed 2578 times
Thank you all for your help.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Large PDF Memory Issues (OutOfMemoryException)

Post by Loïc » Fri Jul 22, 2011 11:09 am

Hi,

We also use ants memory profiler and performance profiler to make GdPicture stronger.

Anyway, I never identified such issue.

It is possible to get a snippet that we can run in batch to reproduce the problem ?
If you can sent it to https://www.gdpicture.com/support/getting-support-from-our-team it should be great.

Cheers,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest