Subject: bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used

From: Chong Yidong <[email-masked]>
Date: Fri, 21 May 2010 13:35:42 -0400

Anders Waldenborg <[email-masked]> writes:

> Well, I'm toying with a little vector graphics API built on top of
> emacs' svg support. And my first real example is a clock. By leaving
> it running for a few minutes easily makes my X server go out of
> memory. You can find the library (vrend.el) and the example
> implementing a clock (vrend-example-clock.el) attached.
>
> Not sure this clock is a real use-case. But I have a few other ideas
> in mind on how to use it, which all have substantially lower
> requirements on refresh rate, but probably large enough to create lots
> of pixmaps in 30 minutes (which seems to be default value for
> image-cache-eviction-delay)

I've committed a change to the trunk that dynamically reduces the
eviction delay, once the number of cached images surpasses 40.  This
should reduce the problem of exploding pixmap consumption.

If you need better behavior, you probably have to handle it manually.
One way is to call `image-refresh' on any image spec that you want to
discard.  This is unintuitive, but `image-refresh' actually uncaches the
target image.  So, if the image is no longer displayed anywhere, it will
be removed from memory.  (We should probably rename `image-refresh' to
`image-uncache' or something like that.)