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

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 14 Jul 2022 12:15:03 +0200

Eli Zaretskii <[email-masked]> writes:

> Don't we allocate memory for the cached stuff?  If so, we could count
> the bytes there, and record them in the cache itself.

No, we just call the gif/webp functions, and they allocate stuff on
their own.  For webp, we do know the size of the main data blob, but not
for GIF -- we just call DGifOpenFileName+DGifSlurp, and looking over the
documentation, there doesn't seem to be any way to get it to cough up
how much data it allocated.

In the non-file case, we know the size of the data blob, and I guess we
could just see how big the GIF file is in the DGifOpenFileName case, and
assume that it allocates memory for the entire file.  (Which may or may
not be true -- perhaps it uses mmap into the file instead, or
whatever...)

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