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

From: Anders Waldenborg <[email-masked]>
Date: Thu, 20 May 2010 22:07:37 +0200

On 05/20/2010 07:16 PM, Chong Yidong wrote:
> You can run (clear-image-cache) to eliminate the image data.  Emacs also
> does this automatically, every hundred redisplays.
>

Thanks,

I can confirm that running (clear-image-cache) removes them from the X 
server.

However I can't see that it is done every 100 redisplays. If it were I 
would expect the code below to never create more than 100 (+ the ones 
that were there before it started) pixmaps in X11. Letting it run while 
writing this mail it now has reached above 3000 pixmaps according to 
xrestop.

(defun aw-svg-image-test-update (buf)
   (interactive)
   (with-current-buffer buf
     (erase-buffer)
     (insert-image (create-image (format "<svg width=\"50\" 
height=\"50\"><rect x=\"0\" y=\"0\" width=\"100\" height=\"100\" 
fill=\"#%02x%02x%02x\"/></svg>" (random 255)(random 255)(random 255)) 
'svg t))))

(defun aw-svg-image-test-kill-buffer-hook ()
   (cancel-timer aw-svg-image-test-timer))

(defun aw-svg-image-test ()
   (interactive)
   (with-current-buffer (generate-new-buffer "*aw-svg-image-test*")
     (display-buffer (current-buffer))
     (make-local-variable 'aw-svg-image-test-timer)
     (add-hook 'kill-buffer-hook 'aw-svg-image-test-kill-buffer-hook nil t)

     (setq aw-svg-image-test-timer (run-at-time nil 0.2 
'aw-svg-image-test-update (current-buffer)))))

  anders