Created attachment 8932 [details] PDF file to reproduce the issue This is extracted from a bigger PDF file. Runnind the mupdf viewer on the file (Windows 7 64bit) increases RAM usage by ~600mb. Testing the mupdf viewer on Android with the file just goes out of memory too.
I have a fix for this that reduces the memory use to ~30Meg. In review now.
Fixed in: commit 4fbdba66f22d7388592c7946de16ec3ee79ade36 Author: Robin Watts <robin.watts@artifex.com> Date: Fri Sep 28 17:51:30 2012 +0100 Bug 693330: Change shadings to decompose to meshes at render time. Currently, the mupdf code loads shadings at parse time, and instantly decomposes them into a mesh of triangles. This mesh of triangles is the transformed and rendered as required. Unfortunately the storage space for the mesh is typically much greater than the original representation. In this commit, we move the shading stream parsing/decomposition code into a general 'fz_process_mesh' function within res_shade. We then grab a copy of the buffer at load time, and 'process' (decompose/paint) at render time. For the test file on the bug, memory falls from the reported 660Mb to 30Mb. For another test file (txt9780547775815_ingested.pdf page 271) it reduces memory use from 750Meg to 33Meg. These figures could be further reduced by storing the compressed streams from the pdf file rather than the uncompressed ones. Incorporating typo fix and unused function removal from Sebras. Thanks. Remove unused function in shading code
Thanks for the bug report, and example file!
Thanks for the fix!