bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33275: 27.0.50; Image cache pruning


From: Eli Zaretskii
Subject: bug#33275: 27.0.50; Image cache pruning
Date: Mon, 05 Nov 2018 18:05:01 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Mon, 05 Nov 2018 15:07:30 +0100
> 
> So after trying various things, it turned out that you can kill Emacs by
> doing this:
> 
> (dolist (file (directory-files "/directory/with/many/images" t "png$"))
>   (image-size (create-image file) t))
> 
> and this is because `image-size' puts the image into the image cache.
> Calling `clear-image-cache' releases the memory.
> 
> I think putting it into the cache is the right thing to do, because if
> you're calling `image-size' on a file, then nine out of ten times you
> want to display it, and my use case here is atypical (batch-processing
> of a large number of huge images), but it's still not optimal that you
> can crash Emacs in this way.

Doesn't this mean that your system's VM is misconfigured?  How is it
Emacs's fault that you've run a program that gobs so much memory as to
trigger the OS's OOM killer?

> So perhaps the cache should be pruned more aggressively according to
> some smart algorithm or other?  Or, at the very least, an
> innocuous-looking function like `image-size' should note in the doc
> string should note what's going on and recommend calling `image-flush'
> afterwards if we don't want to cache the image?

I'm okay with saying something about this in the docs, but frankly,
you could do the same in any number of ways, like by visiting a file
whose size is larger than the VM you allow your system to use, right?
So there's a potential for causing such problems in many different
ways, and warning about that only in the doc string of image-size
seems insufficient, to say the least...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]