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 begin 666 SignPDF.java M:6UP;W)T(&IA=F$N:6\N*CL-"FEM<&]R="!J879A+G-E8W5R:71Y+BH[#0H- M"FEM<&]R="!C;VTN;&]W86=I92YT97AT+BH[#0II;7!O<[EMAIL PROTECTED] M:64N=&5X="YP9&8N*CL-"@[EMAIL PROTECTED] \<#Y4:71L93H@/"]P/@T*("H@ M/' ^1&5S8W)I<'1I;VXZ(#PO<#X-"B J(#QP/D-O<'ER:[EMAIL PROTECTED]>7)I M9VAT("AC*2 R,# T/"]P/@T*("H@/' ^0V]M<&%N>3H@/"]P/@T*("[EMAIL PROTECTED]&%U M=&AO<B!U;F%S8W)[EMAIL PROTECTED] =F5R<VEO;B Q+C -"B J+PT*#0IP=6)L M:6,@8VQA<W,@4VEG;E!$1BI;F<@;5]S=')/=71P=7101$9$;V-U;65N M=" ]("(B.PT*("!3=')I;F<@;5]S=')01EA.86UE(#T@(B([#0H@(%-T<FEN M9R!M7W-T<E!&6%!A<W=O<F0@/2 B(CL-"@T*("!P=6)L:6,@4VEG;[EMAIL PROTECTED] M('L-"B @?0T*#0H@('!U8FQI8R!S=&%T:6,@=F]I9"!M86EN*%-T<FEN9UM= M(&%R9W,I('L-"@T*(" @(%-I9VY01$8@<VEG;E!$1C$@/2!N97<@4VEG;E!$ [EMAIL PROTECTED](" @(&EF*'-I9VY01$8Q+F-H96-K07)G=6UE;G1S*&%R9W,I*0T* M(" @(" @<VEG;E!$1C$N<VEG;[EMAIL PROTECTED]("!]#0H-"B @<'5B;&EC(&)O M;[EMAIL PROTECTED]<F=U;65N=',H4W1R:[EMAIL PROTECTED])G<RE[#0H@(&EF*&%R M9W,N;&5N9W1H(#T](#0I>PT*(" @(&U?<W1R26YP=7101$9$;V-U;65N=" ] M(&%R9W-;,%T[#0H@(" @;5]S=')/=71P=7101$9$;V-U;65N=" ](&%R9W-; M,5T[#0H@(" @;5]S=')01EA.86UE([EMAIL PROTECTED])G<ULR73L[#0H@(" @;5]S=')0 M1EA087-W;W)D([EMAIL PROTECTED])G<ULS73L-"B @("!R971U<[EMAIL PROTECTED]')U93L-"B @?0T* M#0H@(&5L<V4-"B @("!3>7-T96TN;W5T+G!R:6YT;&XH(E5S86=E(&ES(%-I [EMAIL PROTECTED]&([EMAIL PROTECTED](%!&6%]005-35T]21"(I M.PT*(" @(')E='5R;B!F86QS93L-"B @?0T*#0H@("[EMAIL PROTECTED](" @*B!3=&%R M=',@=&AE(%-I9VYI;F<@4')O8V5S<PT*(" @*B\-"B @<'5B;&EC('9O:60@ M<VEG;[EMAIL PROTECTED]>PT*(" @('1R>2![#0H-"B @(" @("\O(&[EMAIL PROTECTED],-"B @ M(" @($ME>5-T;W)E(&MS([EMAIL PROTECTED]<F4N9V5T26YS=&%N8V4H(G!K8W,Q M,B(I.PT*(" @(" @:W,N;&]A9"AN97<@1FEL94EN<'5T4W1R96%M*&U?<W1R M4$983F%M92DL(&U?<W1R4$984&%S=V]R9"YT;T-H87)!<G)A>[EMAIL PROTECTED]"B @ M(" @(%-T<FEN9R!A;&EA<R ]("A3=')I;F<I:W,N86QI87-E<[EMAIL PROTECTED]>'1% M;&5M96YT*"D[#0H@(" @("!0<FEV871E2V5Y(&ME>2 ]("A0<FEV871E2V5Y M*6MS+F=E=$ME>2AA;&EA<RP@;5]S=')01EA087-W;W)D+G1O0VAA<D%R<F%Y M*"DI.PT*(" @(" @:F%V82YS96-U<FET>2YC97)T+D-E<G1I9FEC871E(%M= M(&-H86EN(#T@:W,N9V5T0V5R=&EF:6-A=&5#:&%I;BAA;&EA<RD[#0H-"B @ M(" @(%-Y<W1E;2YO=70N<')I;G1L;[EMAIL PROTECTED])[EMAIL PROTECTED]&\@<W1A<G0@<VEG;FEN M9R!0<F]C97-S+B!0;&5A<[EMAIL PROTECTED]@=&AE(&UE;6]R>2(I.PT*(" @(" @ M4WES=&5M+FEN+G)E860H*3L-"@T*(" @(" @9FEN86P@:6YT('1O=&%L3G5M M8F5R3V93:6=N:6YG<R ](#,[#0H@(" @("!F;W(H:6YT(&D],#MI/'1O=&%L M3G5M8F5R3V93:6=N:6YG<SMI*RLI>PT*(" @(" @("!S:6=N:6YG4$1&*&ME M>2QC:&%I;BQM7W-T<D]U='!U=%!$1D1O8W5M96YT("L@(BTB("L@:2 K("(N M<&1F(BD[#0H@(" @(" @(%-Y<W1E;2YO=70N<')I;G1L;[EMAIL PROTECTED]&Y3=6-C97-S M9G5L;'D@<VEG;F5D('[EMAIL PROTECTED]&]C=6UE;G0@(B K(&[EMAIL PROTECTED] B(&]F("(@ M*R!T;W1A;$YU;6)E<D]F4VEG;FEN9W,@*3L-"B @(" @(" @4WES=&5M+F]U M="YP<FEN=&QN*")0<F5S<R!E;G1E<B!T;R!C;&]S92!T:&[EMAIL PROTECTED];&EC871I M;VXZ("(I.PT*(" @(" @("!3>7-T96TN:6XN<F5A9"@I.PT*(" @(" @?0T* M(" @('T-"B @("!C871C:" H17AC97!T:6]N(&5X*2![#0H@(" @("!E>"YP M<FEN=%-T86-K5')A8V4H*3L-"B @(" @(%-Y<W1E;2YO=70N<')I;G1L;[EMAIL PROTECTED] M1F%I;&5D('1O([EMAIL PROTECTED]&AE(%!$1B!D;V-U;65N="(I.PT*(" @('T-"B @ M?0T*#0HO+RTM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+0T*(" O M*BH-"B @("[EMAIL PROTECTED];G,@=&AE([EMAIL PROTECTED](" @*B! <&%R86T@:V5Y#0H@(" J M($!P87)A;2!C:&%I;@T*(" @*B! <&[EMAIL PROTECTED]')/=71P=7101$9$;V-U M;65N= T*(" @*B! =&AR;W=S($5X8V5P=&EO;@T*(" @*B\-"B\O+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM#0H@('!U8FQI8R!V;VED('-I M9VYI;F=01$8H4')I=F%T94ME>2!K97DL:F%V82YS96-U<FET>2YC97)T+D-E M<G1I9FEC871E(%M=(&-H86EN+ T*(" @(" @(" @(" @(" @(" @(" @(" @ M(%-T<FEN9R!A7W-T<D]U='!U=%!$1D1O8W5M96YT*2!T:')O=W,@17AC97!T M:6]N>PT*(" @(%!D9E)E861E<B!R96%D97(@/2!N97<@4&1F4F5A9&5R*&U? M<W1R26YP=7101$9$;V-U;65N="D[#0H-"B @("!&:6QE3W5T<'5T4W1R96%M M(&9O=70@/2!N97<@1FEL94]U='!U=%-T<F5A;2AA7W-T<D]U='!U=%!$1D1O M8W5M96YT*3L-"B @(" O+R!C<F5A=&EN9R!T:&[EMAIL PROTECTED](" @ M(%!D9E-T86UP97(@<W1P([EMAIL PROTECTED]&1F4W1A;7!E<BYC<F5A=&53:6=N871U<F4H M<F5A9&5R+"!F;W5T+" G7# G+"!N=6QL+"!T<G5E*3L-"B @("!09&93:6=N M871U<F5!<'!E87)A;F-E('-A<" ]('-T<"YG9713:6=N871U<F5!<'!E87)A M;F-E*"D[#0H@(" @<V%P+G-E=$-R>7!T;RAK97DL(&-H86EN+"!N=6QL+"!0 M9&93:6=N871U<F5!<'!E87)A;F-E+E=)3D-%4E]324=.140I.PT*(" @('-A M<"YS971296%S;VXH(DDG;2!T:&[EMAIL PROTECTED]:&]R(BD[#0H@(" @<V%P+G-E=$QO M8V%T:6]N*"),:7-B;VXB*3L-"@T*(" @($)A<V5&;VYT(&)F([EMAIL PROTECTED] M;G0N8W)E871E1F]N="@B2&5L=F5T:6-A(BP@(D-P,3(U,B(L(&9A;'-E*3L- M"B @(" O+R!C;VUM96YT(&YE>'0@;&EN92!T;R!H879E(&%N(&EN=FES:6)L M92!S:6=N871U<F4-"B @("!S87 N<V5T5FES:6)L95-I9VYA='5R92AN97<@ M4F5C=&%N9VQE*# L(# L(#$P,"P@,3 P*2P@,2P@;G5L;"D[#0H@(" @<V%P M+G-E=$QA>65R,E1E>'0H(DAA;&]<;DAE;&QO(BD[#0H-"B @("!09&9496UP M;&%T92!N,2 ]('-A<"YG971,87EE<[EMAIL PROTECTED]@+R]G970@<FED(&]F('1H92!Q M=65S=&EO;B!M87)K#0H@(" @;C$N<V5T1F]N=$%N9%-I>F4H8F8L,3$I.PT* M(" @(&XQ+G-H;W=497AT*")(86QO(BD[#0H@(" @<W1P+F-L;W-E*"D[#0H@ L(" @9F]U="YC;&[EMAIL PROTECTED]@(" @4WES=&5M+F=C*"D[#0H@('T-"GT` ` end ------------------------------------------------------- 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
