OutOfMemory in MuPdf

Hello, I use the MuPdf library in my project to view documents. The problem is that when you open 3-7 documents in action on 11 inches on the tablet, I get a memory overflow. When you upload a new document, all links to the previous document are destroyed, but the image of the document from memory is not deleted. objects are created in a 10-12 megabyte memory image. on a 7-inch tablet, this problem does not occur.

Perhaps someone ran into this problem?

+3
source share
4 answers

This issue is resolved by calling recycle()in a bitmap in the relaeseBitmaps()PageView.java method

public void releaseBitmaps() {
        reinit();
        mEntireBm.recycle();
        mPatchBm.recycle();
        mEntireBm = null;
        mPatchBm = null;
    }
+2
source

Inside mupdf.c find

"/* 128 . . */"

512 ,

0

, PageView.java , , .

if (mEntireBm == null || mEntireBm.getWidth() != newSize.x
                              || mEntireBm.getHeight() != newSize.y) {
            mEntireBm = Bitmap.createBitmap(mSize.x, mSize.y, Bitmap.Config.ARGB_8888);
            System.gc();//Added
            Runtime.getRuntime().gc();//Added
        }

:

0
  • mupdf.c

: /* 128 . . */   glo- > ctx = ctx = fz_new_context (NULL, NULL, 128 < 20); /* 128 . . */   glo- > ctx = ctx = fz_new_context (NULL, NULL, 32 < 20);

. ~ 50 .

-1

All Articles