Hello all.
Maybe you should use the Tools jhat and jmap from your jdk to examine the heap after your first pdf to check if there exits referencepathes from root to the memory consuming objects. If there are such a path, the gc could not free the used memory. Maybe you have to create WeakReference instead of hard object-scope-fields to give the gc a hint. Ex: jmap -dump:format=b,file=heap.bin <pid> jhat -J-mx512m heap.bin The you could point your browser to http://127.0.0.1:7000 Best Regards Thimo Seitz -------------------------------------------- Dipl.-Inf. (FH) Thimo Seitz Geschäftsführer Entwicklung Flyer-Ex Software GmbH Am Weichselgarten 7 91058 Erlangen/Tennenlohe Tel. 09131 / 691-189 <mailto:thimo.se...@flyer-ex.de> thimo.se...@flyer-ex.de <http://www.flyer-ex.de> http://www.flyer-ex.de -------------------------------------------- Von: Massimiliano Ziccardi [mailto:massimiliano.zicca...@gmail.com] Gesendet: Mittwoch, 4. März 2009 16:35 An: Post all your questions about iText here Betreff: Re: [iText-questions] OutOfMemory error Hi all. Thank you for your help. I know (i think) how JVM and GCs works. I KNOW the GC run asyncronously, and I know the memory will be freed when the JVM needs it or when it has some "free time"... I told I think that's not a memory issue because: 1) The readers are always set to null after I close them 2) I'm able to sign the 1st file. After that, the reader is closed and set to 'null'. Then I create a new PdfReader on the next file (a copy of the 1st: actually there are 9 copies of the same file). So, if everything works OK, I should be in the same situation of the first file (and it should work again). Now, when I run the second signature, the JVM will *need* memory to sign it: since all the old objects are unreferenced, that should be the *RIGHT* moment for the GC to run and free the memory, since the JVM needs the unused memory. So, since there is no reason why the 1st signature works and the 2nd doesn't, I though about some leak inside iText (some static data? some static List? I dunno). >fear that he might not have a good understanding of memory/JVM usage as he >>posted several times things like "it must not be a memory limit" when it was, and "I >close the reader each time" What I mean is that I would not consider a memory limit an OutOfMemory if I try to instantiate a 1 GB byte array... Regards, Massimiliano On Wed, Mar 4, 2009 at 2:10 PM, Klas Lindbäck <klas.lindb...@val.se> wrote: || <cid:part1.05020600.06040709@val.se <mailto:cid%3apart1.05020600.06040...@val.se> > > On Wed, Mar 4, 2009 at 3:26 AM, Massimiliano Ziccardi > <massimiliano.zicca...@gmail.com > <mailto:massimiliano.zicca...@gmail.com>> wrote: > > The only object I take in memory is the PDF reader, that, of > course get closed and recreated (with a new instance) after each > signature. > > That should clean the memory, if that's not a leak. > As stated before, the jvm does not necessarily remove unused objects immediately. You can try to force the jvm to do garbage collection by calling: System.gc(); || <cid:part1.05020600.06040709@val.se <mailto:cid%3apart1.05020600.06040...@val.se> > ------------------------------------------------------------------------------ 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
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ 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