PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
System.OutOfMemoryException PdfDictionary https://forum.pdfsharp.net/viewtopic.php?f=2&t=1660 |
Page 1 of 1 |
Author: | stephanrussell [ Wed May 18, 2011 1:01 pm ] |
Post subject: | System.OutOfMemoryException PdfDictionary |
We use a Backend-application to merge and transfer PDF-files on our server. First a customer loads a PDF file in separate pages to our server. It is placed in a Jobs-directory. When the transfer is complete our Backend-application merges the PDF files to one large PDF file. It then transfers the PDF file to a other location on the server. Smaller PDF files are no problem, but when merging a large PDF file(1,2gb and up). We get the following message: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at PdfSharp.Pdf.PdfDictionary.PdfStream.Clone() at PdfSharp.Pdf.PdfDictionary.Copy() at PdfSharp.Pdf.PdfObject.Clone() at PdfSharp.Pdf.PdfObject.ImportClosure(PdfImportedObjectTable importedObjectTable, PdfDocument owner, PdfObject externalObject) at PdfSharp.Pdf.PdfPages.CloneElement(PdfPage page, PdfPage importPage, String key, Boolean deepcopy) at PdfSharp.Pdf.PdfPages.ImportExternalPage(PdfPage importPage) at PdfSharp.Pdf.PdfPages.Insert(Int32 index, PdfPage page) at PdfSharp.Pdf.PdfDocument.AddPage(PdfPage page) at ChrisRussell.Core.PDF.PDFEditor.MergePDFs(String[] pages, String filename) in D:\Source\ChrisRussell\_lib\ChrisRussell.Core.PDF\PDFEditor.cs:line 61 at ChrisRussell.Data.DataChunk.PrepareForPrinting(OrderLine orderLine, Int32 ChunkId, BarcodeLocation barcodeLocation, PrinterQueue printerQueue) in D:\Source\ChrisRussell\_lib\ChrisRussell.Data\DataChunk.cs:line 200 at ChrisRussell.Data.Upload.PrepareForPrinting(OrderLine orderLine, OrderLineChunk ol, BarcodeLocation bl) in D:\Source\ChrisRussell\_lib\ChrisRussell.Data\Upload.cs:line 320 at ChrisRussell.Data.Upload.PreperareForPrinting(OrderLine orderLine) in D:\Source\ChrisRussell\_lib\ChrisRussell.Data\Upload.cs:line 274 at ChrisRussell.Data.OrderLine.PrepareForPrinting() in D:\Source\ChrisRussell\_lib\ChrisRussell.Data\OrderLine.cs:line 302 at ChrisRussell.Data.Order.PrepareForPrinting() in D:\Source\ChrisRussell\_lib\ChrisRussell.Data\Order.cs:line 741 at ChrisRussell.BackEnd.Program.Main() Trying to solve the problem we've bought a new 64bit 4 processor server with 12gb RAM. This didn't solve the problem. The stacktrace shows that "PdfSharp.Pdf.PdfDictionary.PdfStream.Clone()" produces the problem. Can anyone tell me how we can solve the problem? |
Author: | Thomas Hoevel [ Wed May 18, 2011 2:40 pm ] |
Post subject: | Re: System.OutOfMemoryException PdfDictionary |
I presume you made sure that your application is running as a 64 bit process (32 bit processes are limited to 2 or 3 GB). Increasing GDIProcessHandleQuota might help. See the first post by "Mark Wilson-Thomas" in this thread: http://social.msdn.microsoft.com/forums ... 8be25d5c4/ Switching from GDI+ to WPF mode or vice versa could make a difference. |
Author: | stephanrussell [ Thu May 19, 2011 10:32 am ] |
Post subject: | Re: System.OutOfMemoryException PdfDictionary |
Hello Thomas, Thanks for your reaction. The application is a console application. So it's not an WPF application To illustrate te problem, I've added screenshots: http://img860.imageshack.us/i/beforeg.jpg/ You See the application waiting for a PDF File to merge/waiting for an order. The memory use is low. http://img23.imageshack.us/i/before1e.jpg/ Still waiting for an order. here you see the memory use of the application http://img856.imageshack.us/i/aftero.jpg/ You see the application has a outofmemoryexeption . The memory usage is high http://img690.imageshack.us/i/after2l.jpg/ You see the application has a outofmemoryexeption . The memory usage is high The screenshots show the memory flows on the server. greetz |
Author: | Thomas Hoevel [ Thu May 19, 2011 11:19 am ] |
Post subject: | Re: System.OutOfMemoryException PdfDictionary |
stephanrussell wrote: The screenshots show the memory flows on the server. Global memory usage goes up from 39 % to 50 %. And your application is 32 bit, so it's limited to 2 GB. 50 % server memory free, but your app gets an OutOfMemory exception. AFAIK you can use both GDI+ and WPF builds of PDFsharp with console application. So first step: build a 64 bit version of your app and try that. Second step: switch from GDI+ to WPF or vice versa to see if that makes a difference. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |