[Top][All Lists]

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

bug#51763: 27.2; Displaying many images take all memory

From: Stefan Kangas
Subject: bug#51763: 27.2; Displaying many images take all memory
Date: Thu, 11 Nov 2021 01:50:59 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Thierry Volpiatto <thievol@posteo.net> writes:

> I see you changed image-dired to use image-mode in emacs-29 instead of using 
> like
> before image-magick.  That's fine I used the same approach two years ago
> in Helm, but switched back quickly to image-dired because it was taking
> all memory and it was not recoverable until I kill emacs. I thought it
> was my fault but I see new image-dired in emacs-29 have same problem:
> 1) emacs -Q
> 2) Open a large image directory with dired
> 3) Open files one by one with C-t i until memory is full (use f3 C-t i
> C-n f4 etc...). Memory starts to grow seriously after around 70 files
> for me.
> Killing the image-dired buffer changes nothing, I have to restart emacs
> to recover memory.

Thanks for the bug report!

In principle there should be no difference between the two: in both
cases we need to cache the same upscaled image.

However, we currently have an issue with our built-in image scaling that
we cache the image both before resizing and after.  I suspect that this
is the explanation for the higher memory usage you see.

See this comment in `image--scale-within-limits-p':

            ;; Note: `image-size' looks up and thus caches the
            ;; untransformed image.  There's no easy way to
            ;; prevent that.

and the relevant code in image.c that verifies this.

I believe that we could fix this in image.c.  I don't think it's
necessarily very hard, but it does take some coding.

However, I'm curious what you mean when you say that it "never" frees
the memory.  What happens if you set `image-cache-eviction-delay' to
some very low value like 5 seconds?

AFAIU, calling `clear-image-cache' should also the free memory unless we
have a memory leak.  You could also call this function from your code.
Does calling this function free the memory for you?

reply via email to

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