GNU bug report logs -
#51763
27.2; Displaying many images take all memory
Previous Next
Full log
Message #11 received at 51763 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Stefan Kangas <stefan <at> marxist.se> writes:
> Thierry Volpiatto <thievol <at> 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).
Thanks.
--
Thierry
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 3 years and 218 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.