I am generating PDF's using IText and have noticed that the servers I am
using seem to be running out of memory over time. I've turned off my feature
to use IText and the servers seem fine - so I'm fairly certain there's
something within my implementation of IText that is causing a memory leak.
Here's my structure for IText:

Document document = new Document(PageSize.A4);
file = new File("/tmp/Hotel-Fax-" + voucher.getVoucherID() + ".pdf");

PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(file));
writer.setStrictImageSequence(true);
document.open();

PdfContentByte cb = writer.getDirectContent();

//Some methods here which just create PDFPTables and add some text / images

cb.stroke();

document.close();

return file;
I am wondering if there is some way that my PdfWriter or PdfContentByte are
holding on to memory even though I've closed the document, meaning that next
time the code is called, it just creates new objects and the memory
eventually runs out?

Any help would be great!

Thanks, Chris

PS - I do have the iText In Action book 2nd edition so if the answer lies
somewhere in there please let me know.



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Memory-management-using-IText-in-Java-tp4657236.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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

Reply via email to