On 24/03/13 03:34:33 +0100, Sebastian Ramacher wrote:
> ...
> The code to destroy the cairo surfaces periodically is not optimal, but
> if it all, we should fix this portion of the code. Maybe a timing-based
> solution is not a good idea and there are better ways to approach this,
> but I really don't want to ruin the above use case again.
> Ideas and patches to improve the page reclaiming code are very welcome.
> ...

I was thinking about this and thought, that maybe a combination of two
approaches could be possible. I'll try to depict what I have in mind:

    - Load zathura and render the pages (i.e. keep them in memory),
      which are visible. 

    - When scrolling, remember all the pages seen in the last, say, 5

    - If we scroll through many pages, then it means that we are not
      interested in viewing all of the pages, which we have seen in the
      last 5 minutes. Then remember only the last 10 pages.

So in essence, what I propose, is to keep a page buffer which would
remember all pages from last 5 minutes or last 10 pages whichever is
smaller. Of course the quantities here are taken only for illustrative
purposes and I have no idea whether they make sense or not.

Also, I remember, that I hit a mem-leak recently when working on a
poster made with LaTeX. I was recompiling the same page over and over
again with LaTeX and I the memory consumption went very high. I was
wondering if this is because zathura was remembering the pages from the
previous versions of the recompiled document. Maybe zathura should free
memory on document reloads?

Also, I thought a while ago, that zathura's rendering experience could
be even further enhanced by caching the pages, which have not been seen
yet. For example at one moment we see a row of pages and zathura caches
the row above and below the one we currently view. Then if we scroll in
either direction, the page is already rendered, which might be visually
more pleasing than waiting for a large page to come up. Of course, this
should be implemented in such a way, that we do not recache the pages,
which are already among the ones which have been looked at recently.

Let me know if I made the explanation clear enough and if something
similar would be desired in zathura.

All the best,

zathura mailing list

Reply via email to