Thank you for your answer.

I think the problem is elsewhere: here is the test I did.

I have 1GB file.
I copied the 1GB file 9 times.

Than I started signing them: the first file is signed OK, while the second
gives me the OutOfMemory error.

Could it be a memory leak?

Thanks in advance,
Massimiliano

On Tue, Mar 3, 2009 at 5:26 PM, Paulo Soares <psoa...@glintt.com> wrote:

> If you have a lot of object it will still require a lot of memory to store
> the xrefs and other housekeeping objects.
>
> Paulo
>
> > -----Original Message-----
> > From: Massimiliano Ziccardi [mailto:massimiliano.zicca...@gmail.com]
> > Sent: Tuesday, March 03, 2009 4:10 PM
> > To: itext-questions@lists.sourceforge.net
> > Subject: [iText-questions] OutOfMemory error
> >
> > Hi all.
> >
> > I need to sign 9 files each of them 1GB long...
> >
> > I instantiate the reader with
> > PdfReader reader = new PdfReader(new
> > RandomAccessFileOrArray(fIn.getAbsolutePath(), false, true),null);
> >
> > and then I add the signature with:
> >
> > PdfStamper stp = PdfStamper.createSignature(reader, new
> > BufferedOutputStream(new FileOutputStream(fOut)), '\0', fTmp, true);
> >
> > But I get the following OutOfMemory error...
> >
> > Acrobat reader is able to deal the file very efficiently
> > (small memory footprint and very fast).
> >
> > Do you have any idea?
> >
> >  java.lang.OutOfMemoryError: Java heap space
> >     at java.lang.String.toCharArray(String.java:2726)
> >     at com.lowagie.text.pdf.PdfName.<init>(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readDictionary(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readPRObject(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readDictionary(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readPRObject(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readDictionary(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readPRObject(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.readSingleObject(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.getPdfObject(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.getPdfObject(Unknown Source)
> >     at
> > com.lowagie.text.pdf.PdfReader$PageRefs.getSinglePage(Unknown Source)
> >     at
> > com.lowagie.text.pdf.PdfReader$PageRefs.getPageOrigRef(Unknown Source)
> >     at
> > com.lowagie.text.pdf.PdfReader$PageRefs.getPageN(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.getPageN(Unknown Source)
> >     at com.lowagie.text.pdf.PdfReader.getPageNRelease(Unknown Source)
> >     at com.lowagie.text.pdf.AcroFields.fill(Unknown Source)
> >     at com.lowagie.text.pdf.AcroFields.<init>(Unknown Source)
> >     at
> > com.lowagie.text.pdf.PdfStamperImp.getAcroFields(Unknown Source)
> >     at
> > com.lowagie.text.pdf.PdfSignatureAppearance.getNewSigName(Unkn
> > own Source)
> >     at
> > com.lowagie.text.pdf.PdfSignatureAppearance.<init>(Unknown Source)
> >     at com.lowagie.text.pdf.PdfStamper.createSignature(Unknown Source)
> >
> >
> > Thank you in advance,
> > Massimiliano
> >
> >
>
> Aviso Legal:
> Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
> informação confidencial ou legalmente protegida. A incorrecta transmissão
> desta mensagem não significa a perca de confidencialidade. Se esta mensagem
> for recebida por engano, por favor envie-a de volta para o remetente e
> apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o
> destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.
>
> Disclaimer:
> This message is destined exclusively to the intended receiver. It may
> contain confidential or legally protected information. The incorrect
> transmission of this message does not mean the loss of its confidentiality.
> If this message is received by mistake, please send it back to the sender
> and delete it from your system immediately. It is forbidden to any person
> who is not the intended receiver to use, distribute or copy any part of this
> message.
>
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> 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
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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

Reply via email to