Subject: Re: bug#56546: 29.0.50; unbounded RAM comsumption when displaying images

From: Eli Zaretskii <[email-masked]>
Date: Thu, 14 Jul 2022 12:15:50 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Thu, 14 Jul 2022 10:53:12 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Btw, did you try
> >
> >   M-: (clear-image-cache) RET
> 
> The problem is the animation cache, not the image cache, I think.  And I
> see that I forgot to make clear-image-cache clear the animation cache,
> which it should.

When we remove an image from the cache, its animations should also be
removed, I agree.

> And also -- the animation cache should be pruned regularly, but it's not
> only pruned when doing animated images.  I think it should also be
> pruned from...  gc?  Or is there a different place it'd make sense to
> prune that cache from?

GC could be problematic.  Imagine someone who has a frame displayed at
all times animating something -- you don't want to clear those caches,
right?

I think we should perhaps track which images are actually displayed,
and when was the last time they were displayed, and evict them from
the cache after enough time has passed since the image was last
displayed.

> Finally, image-cache-size should also report the animation cache size, I
> think.

That'd help, yes.