all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 33275@debbugs.gnu.org
Subject: bug#33275: 27.0.50; Image cache pruning
Date: Mon, 05 Nov 2018 18:05:01 +0200	[thread overview]
Message-ID: <83va5bcxxu.fsf@gnu.org> (raw)
In-Reply-To: <m3bm73ipnh.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon,  05 Nov 2018 15:07:30 +0100)

> 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	other threads:[~2018-11-05 16:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 14:07 bug#33275: 27.0.50; Image cache pruning Lars Ingebrigtsen
2018-11-05 16:05 ` Eli Zaretskii [this message]
2018-11-05 16:18   ` Lars Ingebrigtsen
2018-11-05 16:23     ` Eli Zaretskii
2018-11-05 16:35       ` Lars Ingebrigtsen
2018-11-05 17:27         ` Eli Zaretskii
2018-11-05 17:36           ` Lars Ingebrigtsen
2018-11-05 17:48             ` Lars Ingebrigtsen
2018-11-05 18:14               ` Eli Zaretskii
2018-11-05 18:35                 ` Eli Zaretskii
2018-11-05 19:13                   ` Lars Ingebrigtsen
2018-11-05 19:28                     ` Eli Zaretskii
2018-11-09 12:22                       ` Lars Ingebrigtsen
2018-11-06 15:40               ` Eli Zaretskii
2018-11-09 12:26                 ` Lars Ingebrigtsen
2018-11-10  9:48                   ` Eli Zaretskii
2019-09-21  8:18                     ` Lars Ingebrigtsen
2018-11-05 18:18             ` Eli Zaretskii
2018-11-05 19:06               ` Lars Ingebrigtsen
2018-11-05 19:24                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83va5bcxxu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33275@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.