-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DjVu documents (and potentially other cases) cause chafa to consume a lot cpu and memory #179
Comments
this has happened to me as well, when previewing a large pdf using lf, my window manager just froze |
Hi, thanks for reporting this. This is happening because Chafa delegates to ImageMagick when there's no internal loader to handle the file format. ImageMagick gets very enthusiastic and sometimes trips on its own shoelaces. The problem is fixed in master and will go away in the next release -- see #157. In the meantime, you should be able to curb problematic formats in ImageMagick's configuration. On my distro, this lives in
The default configuration varies between Linux distros; mine already has PDF on the do-not-load list, and it looks like DjVu support is not built in at all. |
thanks, I look forward to the next release! |
I just released version 1.14.0, where ImageMagick is no longer an option. That should fix the issue (but it will no longer produce previews for DjVu and PDF; maybe one day it will be possible to do so safely). |
Summary:
Since chafa seems to try to display as many file formats as possible, sometimes it might just be inappropriate and should be prevented or optimized.
Example:
One such case is DjVu files, many-page djvu documents to be accurate.
In my exact case, I have set in my lf preview script to use chafa to preview any file of image/* type. Unfortunately, DjVu files are "image/vnd.djvu" type. However, I think the argument applies to more general use cases as well.
When I use chafa to (pre)view a several-hundred-page djvu document, it consumes all the available memory and the system just hangs.
Discussion:
Maybe chafa should at least check for potential memory consumption.
Maybe also optimize the preview, such as only preview the first page, which I believe will never cost many GBs of memory. This possibly applies to PDFs as well, which currently is very slow (a few seconds) to display.
The text was updated successfully, but these errors were encountered: