Bug 691579

Summary: mupdf fails to release memory of previous pages
Product: MuPDF Reporter: Graham Gower <graham.gower>
Component: appsAssignee: Tor Andersson <tor.andersson>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: unspecified   
Hardware: All   
OS: Linux   
Customer: Word Size: ---

Description Graham Gower 2010-08-27 05:30:52 UTC
Memory usage gradually climbs when navigating through a pdf. I'm not sure if this is a bug or a design feature (i.e. cache each page for fast rerendering), but it causes problems on smaller memory machines.

With a long pdf consisting wholly of images, mupdf uses hundreds of MB of ram when navigating through the pages.
Comment 1 Graham Gower 2010-08-31 01:14:33 UTC
Patch below fixes the problem for me.

diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 1393d4e..54827b8 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -274,6 +274,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage)
 		/* Zero search hit position */
 		app->hit = -1;
 		app->hitlen = 0;
+
+		pdf_agestore(app->xref->store, 3);
 	}
 
 	if (drawpage)
Comment 2 Tor Andersson 2010-08-31 11:29:46 UTC
Thanks. Patch applied.