[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: Thierry Volpiatto
Subject: bug#51763: 27.2; Displaying many images take all memory
Date: Thu, 11 Nov 2021 11:22:49 +0000

Stefan Kangas <stefan@marxist.se> writes:

> 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.

Sorry but this is out of my scope.

> 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?

Didn't yet tried this one.

> 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?

Yes it does 🙂.  I didn't know this function (BTW what about renaming to
`image-clear-cache`), works great with my code, perhaps you can do the
same in dired (we use more or less similar code).



Attachment: signature.asc
Description: PGP signature

reply via email to

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