OutOfMemoryException

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for .NET (v6.x)  /  Display Thread

DynamicPDF Merger for .NET (v6.x) Forum

 May 02 2014 11:42 AM

Hi,

We are using DynamicPDF Merger for .NET. and our users randomly get out of memory error when they are using our application to generate pdf portfolios.

Number and size of the files in portfolios are different, but usually between 50 to 100 file, each one 1-2 Mb. Making the portfolio size between 50Mb to 200Mb.

We have 2 Gig memory on each server.

Any suggestion on how to solve\improve this issue?


Error:

Inner Message: Exception of type 'System.OutOfMemoryException' was thrown.
Inner Stack Trace:    at System.IO.MemoryStream.set_Capacity(Int32 value)
   at System.IO.MemoryStream.EnsureCapacity(Int32 value)
   at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at zz93.ma.e(Byte[] A_0, Int32 A_1, Int32 A_2)
   at zz93.ma.a(Byte[] A_0, Int32 A_1, Int32 A_2)
   at zz93.if.a(DocumentWriter A_0)
   at zz93.h0.a(DocumentWriter A_0)
   at ceTe.DynamicPDF.IO.DocumentResourceList.b(DocumentWriter A_0)
   at zz93.ma.u()
   at ceTe.DynamicPDF.Document.Draw(Stream stream)
   at ceTe.DynamicPDF.Document.Draw()



 May 05 2014 4:22 PM
Posted by a ceTe Software moderator
Hello,

The DynamicPDF Merger for .NET API holds the PDF documents in memory while merging and they will be released after the Draw method is called. So you would need to make sure that you have sufficient resources available in your system to handle merging several documents.

Also please take a look at the performance considerations link for Merger. If you are appending the same PDF several times, importing the PDF using the PdfDocument object would help ensure efficient reuse of PDF resources.

Thanks,
ceTe Software Support Team.

 May 05 2014 5:32 PM
Thanks for your reply.

Looking at our web servers, we have more than 1 Gig memory available when we get the OutOfMemory exception. Not sure why this available memory can not be used?

(and in our case we dont append the same file over and over, so I guess the performance tip wouldnt help)


Thanks.
 May 07 2014 11:50 AM
Posted by a ceTe Software moderator
Hello,

The stack trace of the error message shows that the exception is thrown by MemoryStream object and our DynamicPDF API does not set any limits to it at the time of creating this object. Please try creating your own MemoryStream object and output the PDF data to it and see if it works for you. You can refer to the documentation on document output here. The DynamicPDF API is not throwing this exception and since it is thrown by the system you may need to debug the application to check why it is throwing error even though 1 Gig memory is available and how the memory is getting allocated for the applications.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:06 PM.