Just for my own interest, from what I could tell, FileStream
has a close() method ( assuming it is something described on msdn,
I'm still not even sure what langauge you are using...). Why don't
you just try calling that? Remote files can cause issues and I'm
not sure what contract there is to close a file but if the
idea is, " well, it will flush and close on last reference going away"
the memory manager/gc may be able to take its time. If your local
runtime doesn't need memory, it may never have to finalize unreachable
files. Does the PDF code close the stream? If not, just give it a try
if FileStream supports this. Alternatively, at least use normal
tools to see who has what.



----------------------------------------
> From: psoa...@glintt.com
> To: itext-questions@lists.sourceforge.net
> Date: Tue, 11 Aug 2009 16:41:34 +0100
> Subject: Re: [iText-questions] out of Kernel memory
>
> I'm sorry but I can't reproduce it. I checked the all the memory pools and
> handles while it was running and the values were steady. There are no memory
> leaks, file handle leaks or any other leaks that I could think of. If the
> problem is in the remote server you may just write files to it without
> iTextSharp to see if it's not a network problem or something else related to
> your particular configuration.
>
> Paulo
>
> ----- Original Message -----
> From: "Kobty, Joseph" 
> To: "Post all your questions about iText here"
> 
> Sent: Tuesday, August 11, 2009 3:30 PM
> Subject: Re: [iText-questions] out of Kernel memory
>
>
> Change your test to the following and let it run for a few minutes and you
> will see the kernel memory climb
> It does not happen in your example because you are writing to the same file
> name each time. Seems to be as the number of files generated increases, the
> problem occurs.
> Another interesting observation, The kernel memory increases out of control
> on the server where the files are being written to, not on the server where
> the application is running. This is what was throwing me off to think it is
> related to IIS or console application. Try the test below and let it run for
> a few minutes, eventually it will run out of kernel memory. The only
> modification to you code is that I am generating a different file for each
> loop iteration.
> for (int i = 0; i < 1000000; i++)
> {
>
> Document pdfDocument = new Document();
> String outputPath = @"c:\test";
> String reportName = "test" + i.ToString() + ".pdf";
> FileStream strm = new FileStream(Path.Combine(outputPath,
> reportName), FileMode.Create);
>
> PdfWriter writer = PdfWriter.GetInstance(pdfDocument, strm);
>
> pdfDocument.Open();
>
> pdfDocument.Add(new Paragraph("test"));
>
> pdfDocument.Close();
>
> }
>
> -----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" 
> To: "Post all your questions about iText here"
> 
> 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" 
> To: 
> 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 |
> 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/

_________________________________________________________________
Get your vacation photos on your phone!
http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM
------------------------------------------------------------------------------
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