Valentin, Valentin Ivanov wrote > I understand, but how can I clear the memory?
I had a look at the P11Signature class. It looks like it requests a session upon initialization and releases it upon sign() or verify(). Especially I didn't see any session release upon finalization. Thus, if there are initialized Signature objects which are never used to sign() or verify(), they might drain your supply of sessions. In the light of this I wonder why in your case both the org.btrust.signer.PDFSigner (in initSignPDF() called by signPDF()) and com.lowagie.text.pdf.PdfPKCS7 (in the constructor called by PdfSigGenericPKCS.setSignInfo() which in turn is called by PdfSignatureAppearance.preClose) initialize a P11Signature for signing. Either you allow iText to create the signature or do it yourself externally. In the former case the P11Signature initialized by org.btrust.signer.PDFSigner might lock one session if never used, in the latter PdfPKCS7. In any case simply change the code to not initialize a superfluous P11Signature, in the former case by fixing org.btrust.signer.PDFSigner and in the latter by not injecting your PrivateKey into iText. (Or is there an actual requirement to double-sign?) Regards, Mikel PS: Paulo, perhaps PdfPKCS7 should be changed here. It should make sure sign() or verify() is called for its Signature instance (if not null), either as intended or in the finalizer. -- View this message in context: http://itext-general.2136553.n4.nabble.com/SunPKC11-Exception-when-signing-PDF-tp4340293p4348492.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
