Out of Memory Exception

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v5)  /  Out of Memory Exception

DynamicPDF CoreSuite for .NET (v5) Forum

 Aug 13 2010 6:24 PM
I am in the process of evaluating your product for a project I am currently working on. I need to batch 52 photo books into one PDF document which we can then send to a back-end output device. This batch size gives us the most efficient secnario for our workflow. The machine I am testing on has 4 gig of memory with XP as the operating system. Each photo book has 26 pages with images on each page. Each book is about 67 Meg in size. A batch of 52 books should be around 3.5 gig.

Using your software, I have been able to batch 24 books fine. As soon as I try a batch size of 25 books, I get the out of memory error. My machine shows I have 2.5 gig of available Ram but the batch size that is being created for 25 books is 1.7 gig. I have double checked my object management to make sure I was not leaving unused objects in memory. I even tried running my program on a machine that had 8 gig available, and still got the Out of Memory error on a batch of 25 books.

Any thoughts on how I can over-come the "Out of Memory" issue?
 Aug 16 2010 9:57 AM
Posted by a ceTe Software moderator
Hello,

When generating the PDF document using our API, the entire PDF document gets generated in memory before it is output to its destination. So in order to generate PDF with output file size of 3.5 GB, roughly available memory would be around 6.5 – 7.0 GB. It may vary slightly. As long as the resources to generate the PDF of that greater size are available, it should do the conversion fine. We do not impose any limitations or restrictions on the size of the PDF that can be generated by our product.

Thanks,
ceTe Software Support Team
 Aug 16 2010 9:38 PM
If I am running on a 32bit operating system, will I run into the address space limitation of 2 gig?

 Aug 17 2010 8:55 AM
Posted by a ceTe Software moderator
Hello,

Yes that could be the limiting factor. I did review the limitations of virtual memory support for 32-bit OS and it is 2 GB.

We may add support in future for creating PDFs and drawing them out as they get created instead of generating the entire PDF in memory.

Thanks,
ceTe Software Support Team

 Dec 21 2011 5:46 AM
Hi,
I have used the PdfRasterizer for converting the each page of PDF into image. With huge pdf files (more than 300MB approx or more than 250 Pages approx) i frequently getting "Out of Memory" Error.

Please suggest me some techniques ,so that i can bypass this errors.

Below is the Error Occured.

----------------------------------------------------------------
Error Syntax :
(VB.net)

Out of memory.
   at ceTe.DynamicPDF.Rasterizer.PdfRasterizerPage.a(ImageFormat A_0, ImageSize A_1)
   at ceTe.DynamicPDF.Rasterizer.PdfRasterizerPage.Draw(String filePath, ImageFormat imageFormat, ImageSize imageSize)

----------------------------------------------------------------

Thanks,
Chirag
 Dec 21 2011 6:11 AM
Posted by a ceTe Software moderator
Hello Chirag,

It is suggested to use the InputPdf object when reading the PDF file into memory and disposing it after calling the Draw method on the PdfRasterizer object. See sample code below. This ensure that memory is released as soon as the PDF is document is rasterized rather than waiting for the garbage collector to do the clean up. As a result there will be more memory available for the next request.

            InputPdf pdf = new InputPdf(@"C:\MyDocument.pdf");
            PdfRasterizer rasterizer = new PdfRasterizer(pdf);
            for (int i = 0; i < pdf.Pages.Count; i++)
            {
                rasterizer.Pages[i].Draw(@"C:\temp\Image"+"i"+".png",ImageFormat.Png, ImageSize.Dpi72);
                pdf.Pages[i].Dispose();
            }

Please note that the amount of memory used by the Rasterizer to process the request will depend on the output image size and resolution. If you are producing large images with high resolution there should be enough memory available for the Rasterizer to process the request.

Thanks,
ceTe Software Support Team.
 Dec 21 2011 7:06 AM
Thanks Support ,

I already had taken care of each image to be disposed after Draw method.

Currently i am using   ceTe.PdfRasterizer 1.0.1.35 version.

any other ideas?

Chirag



 Dec 21 2011 12:00 PM
Posted by a ceTe Software moderator
Hello Chirag,

The amount of memory used by the Rasterizer to process the request will depend on the output image size and resolution. If you are producing large images with high resolution there should be enough memory in your machine available for the Rasterizer to process the request.

Apart from using the Dispose() method you can also reduce the size/resolution of the output image to prevent the out of memory exception if your machine does not have enough memory to process the request.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:42 AM.