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/>

NOTICE OF CONFIDENTIALITY
This communication including any information transmitted with it is intended 
only for the use of the addressees and is confidential. If you are not an 
intended recipient or responsible for delivering the message to an intended 
recipient, any review, disclosure,  conversion to hard copy, dissemination, 
reproduction or other use  of any part of this communication is strictly 
prohibited, as is the taking or omitting of any action in reliance upon this 
communication. If you receive this communication in error or without 
authorization please notify us immediately by return e-mail or otherwise and 
permanently delete the entire communication from any computer, disk drive, or 
other storage medium. MediSolution contact information may be found at 
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/

Reply via email to