Hello I am using MuPdf library in my project to view documents. The problem is that when you open 3-7 documents in a activity 11 inches on the tablet, i get memory overflow. When you load a new document, all references to the previous document are destroyed, but the image of the document from memory are not removed. objects are created in the memory image of 10-12 megabytes. on tablet the size of 7 inches this problem does not arise.
Maybe someone encountered this problem?
I added the following code to force garbage collector in PageView.java and it seems to work okay so far.
Edited: it crashes after open the file several times
This problem is resolved by calling
recycle()
on bitmap inrelaeseBitmaps()
method of PageView.javaInside mupdf.c find
"/* 128 MB store for low memory devices. Tweak as necessary. */" and
change the memory limit and try
I tried with 512 the rendering is faster than before
Change: /* 128 MB store for low memory devices. Tweak as necessary. */ glo->ctx = ctx = fz_new_context(NULL, NULL, 128 << 20); to /* 128 MB store for low memory devices. Tweak as necessary. */ glo->ctx = ctx = fz_new_context(NULL, NULL, 32 << 20);
That`s all. Max heap memory amount ~50Mb.