Bug 691579 - mupdf fails to release memory of previous pages
Summary: mupdf fails to release memory of previous pages
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: apps (show other bugs)
Version: unspecified
Hardware: All Linux
: P4 normal
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-27 05:30 UTC by Graham Gower
Modified: 2010-08-31 11:29 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.