all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 33275@debbugs.gnu.org
Subject: bug#33275: 27.0.50; Image cache pruning
Date: Mon, 05 Nov 2018 18:36:39 +0100	[thread overview]
Message-ID: <m3tvkvh1eg.fsf@gnus.org> (raw)
In-Reply-To: <83o9b3cu4f.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 05 Nov 2018 19:27:28 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

> I think it's reasonable to expect 2GB worth of image files to take
> several times that in memory.  (Btw, visiting a 16GB file usually
> takes twice that much during insert-file-contents.)

It would be reasonable if the code had asked for those images to be kept
in memory, but it hasn't.  Emacs decides that on its own without saying
that it's doing that.

It'd be similarly surprising if

(dolist (file (directory-files "/directory/with/many/images" t "png$"))
  (with-temp-buffer
    (insert-file-contents-literally file)))

were to lead to Emacs growing uncontrollably.

At present, the image cache is purely based on timestamps, if I recall
correctly?  If we wish to fix this unexpected behaviour, we could also
look at the size of the image cache and perhaps try to limit it, or if
we wanted to be really fancy, we could somehow check whether there's any
references to the images anywhere (beyond the image cache itself).

I think the latter would mean adding some... fun... to the gc system?

Or does Emacs have weak hashes?  In which case the image cache could be
a weak hash and the problem would resolve itself?

> I think we should try to add some code that would call
> display_malloc_warning and/or memory_full, before the system runs out
> of memory.  That should be enough to prevent OOM in such cases.  Can
> you spot why we never called memory_full in this case?

Sorry, I'm not familiar with the memory_full stuff...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2018-11-05 17:36 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
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 [this message]
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=m3tvkvh1eg.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=33275@debbugs.gnu.org \
    --cc=eliz@gnu.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.