pwmt / zathura

Document viewer
https://pwmt.org/projects/zathura
zlib License
1.88k stars 129 forks source link

Crazy memory usage #132

Open sebastinas opened 5 years ago

sebastinas commented 5 years ago

On GitLab by @alyssoncs on Jun 14, 2019, 22:34


When searching through a pdf document the zathura's memory usage goes crazy.

Searching the word "service" in Android Notes for Professionals for example, makes zathura use 4GiB of memory in my machine.

OS: Debian 10

zathura version: 0.4.3

zathura-pdf-poppler version: 0.2.9

sebastinas commented 3 years ago

On GitLab by @philip on Dec 2, 2020, 03:55


I've run into the same issue using Poppler to view chip documentation that can grow to thousands of pages. Using MuPDF dramatically reduced the time required to complete the search and seems to have reduced memory consumption as well.

sebastinas commented 3 years ago

On GitLab by @eop7aB9i on Jan 4, 2021, 19:28


I confirm this for ebboks like https://www.math.ias.edu/~lurie/papers/HA.pdf and https://www.math.ias.edu/~lurie/papers/SAG-rootfile.pdf

The high usage of memory makes kswapd0 as the top CPU usage which makes the system stuck.

sebastinas commented 2 years ago

On GitLab by @kaiWizardly on Oct 24, 2021, 21:56


I think I am facing a similar issue. When I try to search for something for the first time, everything just freezes up. The subsequent searches are fine though

sebastinas commented 1 year ago

On GitLab by @eop7aB9i on Jun 16, 2023, 12:30


Reproducible in 0.5.2 as well.

ldwgchen commented 3 weeks ago

I'd like to suggest an alternative way of searching to mitigate this issue. Instead of iterating through all pages and finding all search results in one go, which is the way of the current implementation, we can stop at the nearest page that yields hits.

I have tried this approach in a draft implementation and found that (to absolutely no one's surprise) it had significantly improved waiting times and memory usage. Perhaps we can add an option called "(toggle) search-once" and let the user choose between this alternative search mode and the original one.

sebastinas commented 3 weeks ago

I don't think an option would be necessary. As long as the same functionality is achieved, the internal implementation should not make a difference.