ahrm / sioyek

Sioyek is a PDF viewer with a focus on textbooks and research papers
https://sioyek.info/
GNU General Public License v3.0
6.99k stars 231 forks source link

High memory usage on macos. #762

Open Lincest opened 1 year ago

Lincest commented 1 year ago

problem

I just opened a 15-page pdf and kept it for an hour, and the memory usage went from 200MB to 1.2GB.

System information and installation method

ahrm commented 1 year ago

Can you share the PDF here?

Lincest commented 1 year ago

Can you share the PDF here?

I don't think this error is related to a specific pdf, because I tried different pdfs today, all between 10-50 pages, but the memory usage is up to 1.9G, and it grows with time.

for example, file with 15 pages (1.3MB):

ElasticFlow.pdf

ahrm commented 1 year ago

Does it grow with time or with the number of pages scrolled? We cache a few pages so some memory increase with usage is expected, but if memory is increasing only with time (no scrolling), then there is a problem.

gogamid commented 1 year ago

same here:

image
ahrm commented 1 year ago

This amount is normal, does it increase with time to unreasonable values? (e.g. more than 4gb)

dbrll commented 1 year ago

I wanted to report the same issue, Sioyek seems to use vast amounts of memory to open a PDF, sometimes more than 1GB. Apple's Preview uses a third of it. However its RSS is fairly small in comparison, about 56MB here. Here are the two programs with the same short PDF opened:

Screenshot 2023-07-15 at 09 43 36

I suspect this may be caused by the lack of a native ARM64 build, the binary translation must add some overhead and resource usage. This may also explain why it's always using a couple percent CPU (and drain the battery) while Preview sits at 0%.

ahrm commented 1 year ago

Sioyek can be built natively for Arm64 already with no change to source code. The problem is, since I don't have a mac machine, I rely on github actions to build the release binaries and they don't have arm mac machines yet.

Anyway, I doubt the problem is even the architecture. Because of very high resolution displays on mac machines the bitmap of a single page can take upwards of 100MB, and we cache a few pages, which can consume ~1GB of memory, which I consider reasonable. I could make the cache size configurable in future versions so we use less memory for cache.

Zewbiee commented 1 year ago

I also met a high memory usage on windows. And maybe have scrolled too many pdfs, I got an "out of memory" error and then I rebooted machine. After that, I cannot make sioyek work any more, which means it just display a pure white board each time I open sioyek, and I cannot open the list of commands by pressing :, and I cannot shift open another pdf or open any new pdf (only pure white board is displayed). How can I make sioyek work again? @ahrm

Zewbiee commented 1 year ago

How can I make sioyek work again?

After I reinstalled the sioyek and found it still didn't work, I realized there is something wrong with my computer, so I rebooted again and the problems gone.

ideologysec commented 10 months ago

Good news, arm64 macOS GitHub Runners are at least in public beta:

https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/

miss4chewN8 commented 7 months ago

Want to bring up the same issue. Has the cache sizing been fixed?

image image
kepler471 commented 3 weeks ago

Hey, I'm havng a similar issue. The memory grows directly with me scrolling through a pdf on the app.

Specs: Macbook Pro M2 Pro macOS Sonoma 14.3 sioyek version 2.0.0, installed with brew.

~ » brew info sioyek
==> sioyek: 2.0.0
https://sioyek.info/
Installed
/opt/homebrew/Caskroom/sioyek/2.0.0 (221B)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/s/sioyek.rb
==> Name
Sioyek
==> Description
PDF viewer designed for reading research papers and technical books
==> Artifacts
sioyek.app (App)
/opt/homebrew/Caskroom/sioyek/2.0.0/sioyek.wrapper.sh -> sioyek (Binary)
==> Analytics
install: 150 (30 days), 495 (90 days), 2,129 (365 days)

Video shows me scrolling through a 21 page pdf, with no notes, links or bookmarks.

https://github.com/user-attachments/assets/cfef75a0-6e55-4e53-9de8-e75f8e09e3b8

ahrm commented 3 weeks ago

Does the issue happen on the development branch?

kepler471 commented 3 weeks ago

Does the issue happen on the development branch?

I'll try it out and let you know :)

kepler471 commented 3 weeks ago

Does the issue happen on the development branch?

Sorry I've not been able to get the development branch to build on mac. I think I'm getting issues with zsh, is there a bash alternative for the setopt line? Also, do I need to use the alternate qt6 install? why cant I use the brew install?

ahrm commented 3 weeks ago

is there a bash alternative for the setopt line?

Hmmm what setopt line?

Also, do I need to use the alternate qt6 install?

I am not sure, it might work with the brew install, I don't have a mac so I can't test that. You might need to install some additional qt library packages (at least that's the case in linux)