Using PDFViewCtrl with minimum memory

In this document

In order to achieve smoother viewing experience, PDFViewCtrl keeps invisible content. However, keeping invisible content increases memory usage. Android sets an upper bound on the VM heap size allowed for an app. By default, PDFViewCtrl is set to use a quarter of maximum VM heap size for keeping visible and invisible content. Based on the memory footprint of your app, you may want to customize it.

In order to customize the memory usage, call PDFViewCtrl.setRenderedContentCacheSize(long):

long allowed_max = Runtime.getRuntime().maxMemory() / (1024 * 1024);
 //should NOT use close to allowed_max
pdfViewCtrl.setRenderedContentCacheSize((long) (allowed_max * 0.25));

where pdfViewCtrl is an instance of PDFViewCtrl.

If you want to minimize the heap memory usage at the cost of viewing experience quality, you can set allowed_max to 0. PDFViewCtrl will not keep any invisible content.
setRenderedContentCacheSize(long) only controls the memory usage of VM heap size by PDFViewCtrl, but not the native memory that PDFViewCtrl might use.

Increasing Android heap size

On Android 3.0 and above, you can also increase the allowed heap size of an app.

In your app AndroidManifest.xml file, add android:largeHeap="true" to <application> tag:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""