Actually, it is when I run it as part of an IIS process (WCF service) I get this behavior (regardless 32 or 64 bit IIS) It works if I run it as a console application. I do not get the memory leak
-----Original Message----- From: Paulo Soares [mailto:psoa...@glintt.com] Sent: August 10, 2009 5:03 PM To: Post all your questions about iText here Subject: Re: [iText-questions] out of Kernel memory I have this code running and all is ok. for (int i = 0; i < 1000000; i++) { Document pdfDocument = new Document(); FileStream strm = new FileStream("c:\\atp.pdf", FileMode.Create); PdfWriter writer = PdfWriter.GetInstance(pdfDocument, strm); pdfDocument.Open(); pdfDocument.Add(new Paragraph("test")); pdfDocument.Close(); } Paulo ----- Original Message ----- From: "Kobty, Joseph" <joseph.ko...@medisolution.com> To: "Post all your questions about iText here" <itext-questions@lists.sourceforge.net> Sent: Monday, August 10, 2009 9:32 PM Subject: Re: [iText-questions] out of Kernel memory Yes I am using V4.1.6. The .NET I have installed has version 2.0.50727.42 Which I believe has the latest service packs. -----Original Message----- From: Paulo Soares [mailto:psoa...@glintt.com] Sent: August 10, 2009 4:16 PM To: Post all your questions about iText here Subject: Re: [iText-questions] out of Kernel memory Are you using iTextSharp 4.1.6? If you are using .NET 2.0 without SP1 you may have leaks due to leaks in the framework. Paulo ----- Original Message ----- From: "Kobty, Joseph" <joseph.ko...@medisolution.com> To: <iText-questions@lists.sourceforge.net> Sent: Monday, August 10, 2009 8:46 PM Subject: [iText-questions] out of Kernel memory Hi I am creating PDF documents on the fly using iTextSharp. I noticed that the server where I am running this process runs out of Kernel memory (System memory) After about 50,000 files. I commented out all the code to see what is causing it, and it seems the mere fact of opening a PDF document and writing something simple like "test" and then closing it, uses a bit of kernel memory each time which is never released, so as thousands of files are created the kernel memory usage keeps climbing until my server finally shuts down and reboots. Seems to be done by the simple action of opening and closing a pdf document. For (int I = 0; I < 100000; i++) { Document pdfDocument = new Document(); String outputPath = @"C:\"; String reportName = "test" + i.ToString() + ".pdf"; using (FileStream strm = new FileStream(Path.Combine(outputPath, reportName), FileMode.Create)) { PdfWriter writer = PdfWriter.GetInstance(pdfDocument, strm); pdfDocument.Open(); pdfDocument.Add(new Paragraph("test")); strm.Close(); writer.Close(); pdfDocument.Close(); } } Joseph Kobty Team leader/Business analyst MediSolution Ltd. | A Brookfield Asset Management Company 5915 Airport Road, Suite 810, Mississauga, Ontario, L4V 1T1 Tel 905.673.4100 ext 4042 joseph.ko...@medisolution.com<mailto:first.l...@medisolution.com> | www.medisolution.com<http://www.medisolution.com/> ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/