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

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 14 Jul 2022 11:20:53 +0200

Eli Zaretskii <[email-masked]> writes:

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

The image cache is for displayed images, so an animated image will
usually have dozens of image cache entries, so it doesn't work that way.

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

No, but the cache should be pruned of old entries.  (Which is what the
pruning function does.)

>> Finally, image-cache-size should also report the animation cache size, I
>> think.
>
> That'd help, yes.

Looking at that now, that's easier said than done, because the animation
caches are opaque -- we call out to support libraries, and it doesn't
look like all of them have a way to say how much memory they use.  (I'm
looking at the webp functions right now...)

But we can at least include the size of the main data blob (e.g., the
.webp data itself); we know the size of that for all the anim caches.

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