I made the changes you suggested and is working very good.

 

Thanks, Paulo (and everybody else) for all your help!

 

Elvis Novas.


> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: Re: [iText-questions] PDFReader doesn't Garbage Collect
> Date: Sat, 29 Apr 2006 09:32:51 +0100
>
> Add this to PdfCopy:
>
>     public void freeReader(PdfReader reader) throws IOException {
>         indirectMap.remove(reader);
>         if (currentPdfReaderInstance != null) {
>             if (currentPdfReaderInstance.getReader() == reader) {
>                 try {
>                     currentPdfReaderInstance.getReader().close();
>                     currentPdfReaderInstance.getReaderFile().close();
>                 }
>                 catch (IOException ioe) {
>                     // empty on purpose
>                 }
>                 currentPdfReaderInstance = null;
>             }
>         }
>     }
>
>
> Paulo
>
> ----- Original Message ----- 
> From: "Elvis Novas" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, April 28, 2006 9:57 PM
> Subject: RE: Re: [iText-questions] PDFReader doesn't Garbage Collect
>
>
> Thanks, Matt... Paulo, will it be possible to get the update through another 
> venue?
>
> TIA,
>
> Elvis Novas
>
> > From: [EMAIL PROTECTED]> Subject: RE: Re: [iText-questions] PDFReader 
> > doesn't Garbage Collect> To: [email protected]> Date: 
> > Fri, 28 Apr 2006 12:57:52 -0700> > sourceforge anonymous CVS access has 
> > been unavailable> all month.  It may be back in a few more days... ?  :(> 
> >  > -Matt> > --- Elvis Novas <[EMAIL PROTECTED]> wrote:> > > Paulo,> >  > > I 
> > have not been able to login to cvs following the> > instructions from> > 
> > http://www.lowagie.com/iText/cvs.html using wincvs> > or the command line. 
> > If you have any other way to> > get the update I will really appreciate 
> > it.> >  > > Thanks again,> >  > > Elvis Novas> > > > > > Subject: RE: Re: 
> > [iText-questions] PDFReader doesn't> > Garbage CollectFrom: 
> > [EMAIL PROTECTED]:> > [EMAIL PROTECTED]: Fri, 
> > 28> > Apr 2006 17:28:41 +0100> > > > > > > > I've located the problem and 
> > the fix is in the CVS.> > After using the pdf call PdfCopy.freeReader().> 
> >  >  > > Paulo> > > > > > > > From: 
> > [EMAIL PROTECTED]> > 
> > [mailto:[EMAIL PROTECTED]> > On Behalf Of Elvis 
> > NovasSent: Friday, April 28, 2006> > 5:02 PMTo:> > 
> > [EMAIL PROTECTED]: RE:> > Re: [iText-questions] 
> > PDFReader doesn't Garbage> > Collect> > > > Then, something (that I cannot 
> > see through the> > OptimizeIt) is causing the PdfReader to not be> > 
> > released ( garbage collected) until the end of the> > process. 
> > Nevertheless, the PdfImportedPage object is> > being garbage collected 
> > every x number of instances.> >  > > By the way, I downloaded the version 
> > 1.4 and tested> > it using PdfReader(RandomAccessFileOrArray) instead> > 
> > of PdfReader(String) and the application is not> > running out of memory 
> > but still the PdfReader is not> > being garbage collected but just when 
> > the process> > ends.> >  > >  > > HTH,> >  > > Elvis Novas> > > > > > 
> > Subject: RE: Re: [iText-questions] PDFReader doesn't> > Garbage 
> > CollectFrom: [EMAIL PROTECTED]:> > 
> > [EMAIL PROTECTED]: Fri, 28> > Apr 2006 15:39:10 
> > +0100> > > > > > PdfCopy only holds the reference to the last added> > 
> > PDF. In any case I'll do some testing to see if> > something is broken.> > 
> >  > > Paulo> > > > > > > > From: 
> > [EMAIL PROTECTED]> > 
> > [mailto:[EMAIL PROTECTED]> > On Behalf Of Elvis 
> > NovasSent: Friday, April 28, 2006> > 2:31 PMTo:> > 
> > [EMAIL PROTECTED]: RE:> > Re: [iText-questions] 
> > PDFReader doesn't Garbage> > Collect> > > > Actually, I am looping (not in 
> > the example) through> > a number of Pdf files (currentPdfFile) and after> 
> >  > adding the Imported Page to the PdfCopy I am setting> > the pdfReader 
> > object to null (not in the example),> > so I am expecting this object to 
> > be garbage> > collected a any time during the process.> >  > > Thanks for 
> > your help,> >  > > Elvis Novas> > > > > From: [EMAIL PROTECTED]> To:> > 
> > [email protected]> Subject: Re:> > [iText-questions] 
> > PDFReader doesn't Garbage Collect>> > Date: Thu, 27 Apr 2006 21:20:42 
> > +0100> > When did> > you expect PdfReader to be garbage collected? In> > 
> > your code it's > used up to end.> > Paulo> > -----> > Original 
> > Message ----- > From:> > <[EMAIL PROTECTED]>> To:> > 
> > <[email protected]>> Sent:> > Thursday, April 27, 2006 
> > 4:57 PM> Subject:> > [iText-questions] PDFReader doesn't Garbage Collect>> 
> >  > > > Hi All,> > > > I'm generating a Book (PDF file)> > using Java. The 
> > book is made of several> existent> > pdf files (mostly images) as pages 
> > and when this> > book reaches a> significant amount of MBs I'm> > running 
> > out memory. Checking the process> using> > OptimizeIt in JBuilder I'm 
> > noticing that PDFReader> > is not "garbage> collecting" this object 
> > causing the> > application to hang because of the> memory problem.> > If 
> > Increase the memory I'm able to finish the> > process> but I don't think 
> > that should be the> > solution since we consider that> what the JVM has> > 
> > now is good enough. By the way, the size of the> > last> book (it varies 
> > based on different business> > needs) 96 MB.> > > > The following is the 
> > approach I> > taking (not actual code):> > Document  mainDocument> > = new 
> > Document(PageSize.LETTER, 36, 36, 36, 36);> >> > FileOutputStream  book = 
> > new> > FileOutputStream(outputFile);> > PdfCopy  pdfCopy => > new 
> > PdfCopy(mainDocument, book);> >> > mainDocument.open();> > > > 
> > PdfReader> > pdfReader = new PdfReader(currentPdfFile); ====>>> > here's 
> > where OptimizeIt is showing the memory leak.>> > > 
> > PdfImportedPage importedPage =>> > pdfCopy.getImportedPage(pdfReader, 1);> 
> >  >           > >  pdfCopy.addPage(importedPage);> > > >> > 
> > mainDocument.close();> > > > > > TIA,> > > > Elvis> > Novas> > > > > > >> 
> >  >> ------------------------------------------------------->> > Using 
> > Tomcat but need to do more? Need to support> > web services, security?> 
> > Get stuff done quickly with> > pre-integrated technology to make your job 
> > easier>> > Download IBM WebSphere Application Server v.1.0.1> > based on 
> > Apache Geronimo>> >> 
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>> 
> >  > _______________________________________________>> > iText-questions 
> > mailing list>> > [email protected]>> >> 
> > https://lists.sourceforge.net/lists/listinfo/itext-questions> > > > > 
> > __________________________________________________> Do You Yahoo!?> Tired 
> > of spam?  Yahoo! Mail has the best spam protection around > 
> > http://mail.yahoo.com > > 
> >  > -------------------------------------------------------> Using Tomcat 
> > but need to do more? Need to support web services, security?> Get stuff 
> > done quickly with pre-integrated technology to make your job easier> 
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache 
> > Geronimo> 
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> 
> > _______________________________________________> iText-questions mailing 
> > list> [email protected]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions 
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to