Evince memory consumption

xpdf does not seem to be installable on debian nowadays so I had to find an alternative pdf viewer. I settled on evince. It did not show the document's table of contents like xpdf did but I could view the pages and search. Fine.

Out of the blue I noticed that evince had a daemon process running and the evince process itself was taking 330 mb of RSS. My first question was "why does a pdf viewer need a daemon process?". Probably some gnome thing. Whatever. My next question was "does a pdf viewer really need 330 mb of allocated memory to show me a pdf document?" The document I had open was pretty large, on the order of 2000 pages, but 330 mb seemed excessive.

Before I checked how answer the second question I poked evince a little to see if I could reproduce the memory burn. As the only operations I did was open a document and search it, I closed and opened the same document back and started searching. Each time I ran a search the size of the process grew. And grew. It looks like evince never released whatever memory it allocated during each search. It did not take me long to reach 500 mb of RSS. Then I became curious if I could break 1 gig of munched memory.

I searched for A, the single letter. What I did not mention yet is that evince, apparently, collects the search results in a sidebar. These are sometimes useful and sometimes not. Searching for A probably put the entire document in the sidebar, which was arguably not useful. As that was happening I watched the size of the process and eventually it passed 1 gb RSS... with the rest of the system going into swap to make room.

I killed evince once it hit the 1 gb mark as searching was getting progressively slower (I wonder why).

Subsequently I loaded the same document into xpdf. xpdf required 30 mb of RSS to show the document, table of contents and search it. Search in xpdf simply highlights each next match in the document and therefore probably requires constant memory.

Now I am going to see how I can have xpdf back in debian.