I still don't have any problems. I signed, using your code,
PDFReference16.pdf 30 times with -mx256m. With -mx128m it doesn't have
enough memory. The free memory I got:

About to start signing Process. Please check the memory

93526736
Successfully signed the PDF document 0 of 30
101141896
Successfully signed the PDF document 1 of 30
102630392
Successfully signed the PDF document 2 of 30
102218504
Successfully signed the PDF document 3 of 30
110801112
Successfully signed the PDF document 4 of 30
102998608
Successfully signed the PDF document 5 of 30
102634544
Successfully signed the PDF document 6 of 30
102216232
Successfully signed the PDF document 7 of 30
110834888
Successfully signed the PDF document 8 of 30
103033136
Successfully signed the PDF document 9 of 30
102669864
Successfully signed the PDF document 10 of 30
102252344
Successfully signed the PDF document 11 of 30
110834952
Successfully signed the PDF document 12 of 30
103033200
Successfully signed the PDF document 13 of 30
102669880
Successfully signed the PDF document 14 of 30
102252376
Successfully signed the PDF document 15 of 30
110835000
Successfully signed the PDF document 16 of 30
103033248
Successfully signed the PDF document 17 of 30
102669912
Successfully signed the PDF document 18 of 30
102252392
Successfully signed the PDF document 19 of 30
110835000
Successfully signed the PDF document 20 of 30
103033248
Successfully signed the PDF document 21 of 30
102669912
Successfully signed the PDF document 22 of 30
102252392
Successfully signed the PDF document 23 of 30
110835000
Successfully signed the PDF document 24 of 30
103033248
Successfully signed the PDF document 25 of 30
102669912
Successfully signed the PDF document 26 of 30
102252392
Successfully signed the PDF document 27 of 30
110835000
Successfully signed the PDF document 28 of 30
103033248
Successfully signed the PDF document 29 of 30

Best Regards,
Paulo Soares

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Wahaj
> Sent: Tuesday, January 18, 2005 11:12 AM
> To: [email protected]
> Subject: [iText-questions] Re: Re: Re: signing 10 MB sized 
> pdf document
> 
> Hi Paulo,
> 
> Yes I have tried to sign 10 MB pdfs and you are right after the first
> signing, for the later pdf signings it won't take more memory 
> provided the
> pdf you are using for later signing is not greater than 10 MB 
> other wise it
> will take more memory (I have earlier tried to sign 1 MB, 
> 2MB, 4MB, 8MB pdfs
> and the memory kept on increasing). Question is that why does 
> the memory
> don't come back after some time. At the moment he only way of 
> getting the
> memory back is to restart the program.
> 
> Attached is the code which I am using and I don't see any 
> special thing
> which I am doing. I am signing Acrobat-Core-API-Reference.pdf 
> document for
> testing. If you need that pdf I can send that you too.
> 
> Regards
> Wahaj
> 
> "Paulo Soares" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Wahaj
> > Sent: Monday, January 17, 2005 1:53 PM
> > To: [email protected]
> > Subject: [iText-questions] Re: Re: signing 10 MB sized pdf document
> >
> > In most of the cases it keeps on taking more memory until Out
> > Of Memory
> 
> Most of the cases? It either leaks or not.
> 
> > error is shown. I have also tested encryption of pdf document
> > and the memory
> > utilization is lower than while signing but it still grows.
> > Is there a way
> > to resolve this issue ?
> 
> I don't have any issue. I've just finished signing 1000 docs, each 10M
> in size without any problem. I used this code:
> 
> for (int k = 0; k < 1000; ++k) {
>     KeyStore ks = KeyStore.getInstance("pkcs12");
>     ks.load(new FileInputStream("c:\\certvery2.pfx"),
> "password".toCharArray());
>     String alias = (String)ks.aliases().nextElement();
>     PrivateKey key = (PrivateKey)ks.getKey(alias,
> "password".toCharArray());
>     Certificate[] chain = ks.getCertificateChain(alias);
>     PdfReader reader = new PdfReader("c:\\smith.pdf");
>     FileOutputStream fout = new FileOutputStream("c:\\smith_sig.pdf");
>     PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0');
>     PdfSignatureAppearance sap = stp.getSignatureAppearance();
>     sap.setCrypto(key, chain, null,
> PdfSignatureAppearance.VERISIGN_SIGNED);
>     sap.setReason("I'm the author");
>     sap.setLocation("Lisbon");
>     sap.setVisibleSignature(new Rectangle(100, 100, 300, 
> 200), 1, null);
>     stp.close();
>     System.out.println("Sign " + k + " Mem " +
> Runtime.getRuntime().freeMemory());
> }
> 
> Using Sun's jdk in windows 1.4.2_05b with -mx128m.
> 
> Unless you produce code and a pdf so that I can reproduce the 
> problem I
> believe the case is closed.
> 
> >
> > Regards,
> > Wahaj
> >
> > "Paulo Soares" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > What happens if you sign many 10M docs in a row?
> >
> > > -----Original Message-----
> > > From: Wahaj [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, January 14, 2005 2:56 PM
> > > To: Paulo Soares; [email protected]
> > > Subject: Re: [iText-questions] Re: signing 10 MB sized 
> pdf document
> > >
> > > Yeah even after an explicit gc( ).
> > >
> > > Yes it comes down but a bit I mean i tried to sign a 10 MB
> > > file where the
> > > application took 20 MB RAM at the start and then the
> > > application took 120
> > > MB  and then dropped to 95. It should have came down to 20 MB.
> > >
> > > Regards,
> > > Wahaj
> > >
> > > ----- Original Message ----- 
> > > From: "Paulo Soares" <[EMAIL PROTECTED]>
> > > To: "Wahaj" <[EMAIL PROTECTED]>;
> > > <[email protected]>
> > > Sent: Friday, January 14, 2005 7:44 PM
> > > Subject: RE: [iText-questions] Re: signing 10 MB sized 
> pdf document
> > >
> > >
> > > > Even after an explicit gc()?
> > > >
> > > > > -----Original Message-----
> > > > > From: [EMAIL PROTECTED]
> > > > > [mailto:[EMAIL PROTECTED] On
> > > > > Behalf Of Wahaj
> > > > > Sent: Friday, January 14, 2005 1:04 PM
> > > > > To: [email protected]
> > > > > Subject: [iText-questions] Re: signing 10 MB sized 
> pdf document
> > > > >
> > > > > Hi Paulo,
> > > > >
> > > > > I have an observation regarding iText. After the signing
> > > > > process is complete
> > > > > the application don't release the amount of memory which was
> > > > > used in the
> > > > > signing of the pdf
> > > > >
> > > > > Example:
> > > > > When the Java application was launched the system memory was
> > > > > at 100 MB, when
> > > > > signing process just have to start the system memory is at
> > > > > 105 MB, after the
> > > > > signing process is compeleted the memory goes to 120MB. Now
> > > > > it seems that it
> > > > > took 20MB for iText to sign the PDF document (This may vary
> > > > > depending upon
> > > > > the size of the PDF document which is fine keeping in view
> > > > > that iText loads
> > > > > the compelete PDF in one go). Question is that after the
> > > > > signing is done the
> > > > > memory stays at 120MB. It might come down to 119 MB but don't
> > > > > come back to
> > > > > 105 MB. It seems that iText is not releasing the memory it
> > > > > took to sign the
> > > > > pdf why is that ?
> > > > >
> > > > > Regards,
> > > > > Wahaj
> > > > >
> > > > > "Paulo Soares" <[EMAIL PROTECTED]> wrote in message
> > > > > 
> news:[EMAIL PROTECTED]
> > > > > 100M looks too much but reading a pdf requires memory. One
> > > > > day PdfReader
> > > > > will work incrementally but until then...
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: [EMAIL PROTECTED]
> > > > > > [mailto:[EMAIL PROTECTED] On
> > > > > > Behalf Of Wahaj
> > > > > > Sent: Tuesday, January 11, 2005 6:16 AM
> > > > > > To: [email protected]
> > > > > > Subject: [iText-questions] signing 10 MB sized pdf document
> > > > > >
> > > > > > Hi All,
> > > > > >
> > > > > > I am trying to digitally sign a 10 MB pdf document and
> > > > > > getting out of memory
> > > > > > exceptions using iText samples [it took more than 100 MB for
> > > > > > the sample]. I
> > > > > > know how to increase the heap size to remove this 
> problem but
> > > > > > I was thinking
> > > > > > whether some effective memory management can be 
> made in iText
> > > > > > like streaming
> > > > > > of some sort which donot take much memory while signing.
> > > > > > Think about signing
> > > > > > a 20 MB+ pdf document which would really eat up system's
> > > > > > memory. Is there a
> > > > > > way ?
> > > > > >
> > > > > > Regards,
> > > > > > Wahaj
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > -------------------------------------------------------
> > > > > > The SF.Net email is sponsored by: Beat the 
> post-holiday blues
> > > > > > Get a FREE limited edition SourceForge.net t-shirt from
> > > ThinkGeek.
> > > > > > It's fun and FREE -- well,
> > > > > almost....http://www.thinkgeek.com/sfshirt
> > > > > > _______________________________________________
> > > > > > iText-questions mailing list
> > > > > > [email protected]
> > > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > The SF.Net email is sponsored by: Beat the post-holiday blues
> > > > > Get a FREE limited edition SourceForge.net t-shirt from
> > ThinkGeek.
> > > > > It's fun and FREE -- well,
> > > almost....http://www.thinkgeek.com/sfshirt
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > The SF.Net email is sponsored by: Beat the post-holiday blues
> > > > > Get a FREE limited edition SourceForge.net t-shirt from
> > ThinkGeek.
> > > > > It's fun and FREE -- well,
> > > almost....http://www.thinkgeek.com/sfshirt
> > > > > _______________________________________________
> > > > > iText-questions mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > > >
> > > >
> > >
> > >
> >
> >
> > -------------------------------------------------------
> > The SF.Net email is sponsored by: Beat the post-holiday blues
> > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> > It's fun and FREE -- well, 
> almost....http://www.thinkgeek.com/sfshirt
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > The SF.Net email is sponsored by: Beat the post-holiday blues
> > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> > It's fun and FREE -- well, 
> almost....http://www.thinkgeek.com/sfshirt
> > _______________________________________________
> > iText-questions mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> 
> 
> 


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to