0

In my app, I have to open an editable PDF file after populating a few values. For populating values, I use PdfReader, PdfStamper & AcroFields classes from iTextPDF Library. After populating values, I'm making all these objects null.

The PDF file is displayed in an activity which uses Qoppa Library classes like PDFDocument, QPDFNotesView. The heap size used by my app is consistent till I open a PDF. Heap size reaches very high after opening a PDF for the first time. From second time onwards, heap size increases gradually, but slightly. After opening a PDF 3 or 4 times continuously, app crashes due to java.lang.OutOfMemoryError.

If I opened a PDF only once, the heap size remains the same at that high point till I run app for the next time. I have nullified all the objects of above mentioned classes when I finish that activity.

Problem is this:

Heap size never gets down once I use these objects even if I nullify after usage.

I use itextpdf-5.1.3.jar and qoppapdf.jar as private libraries. Can anyone help me to solve this? Thanks a lot in advance...

4

1 回答 1

0

After calling releaseDocument() method of QPDFNotesView class, there is a fair progress in memory freeing.

We had an object

    QPDFNotesView viewer = new QPDFNotesView(this);

called this method after usage in finally

    viewer.releaseDocument();

This has resolved my problem to an extend.

于 2013-10-28T12:44:39.563 回答