unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
@ 2010-05-20 15:40 Anders Waldenborg
  2010-05-20 17:16 ` Chong Yidong
  0 siblings, 1 reply; 8+ messages in thread
From: Anders Waldenborg @ 2010-05-20 15:40 UTC (permalink / raw)
  To: 6230


By running the command defined by the following:

(require 'cl)
(defun aw-replace-buffer-contents-with-svg-images ()
   (interactive)
   (erase-buffer)
   (dotimes (N 200)
     (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))))

the current buffer will be replaced with 200 images. Running xrestop it
can easily be seen that 200 pixmaps are added to the X11 server every
time the command is run.

One would expect that the pixmaps were removed from X11 when they don't
exist in any buffer any longer (which is why recipe uses erase-buffer so
it can be run multiple times, increasing number of pixmaps every time -
not the behaviour I expect).

The pixmaps doesn't even go away when the buffer is killed.

Don't know if this applies to all image types or only svg.


In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
  of 2010-05-16 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'i486-linux-gnu' '--build' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var/lib' 
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' 
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 
'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 
'CPPFLAGS=''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
<down-mouse-2> <mouse-2> <up> <up> <up> <up> <up> <up>
<up> <left> <left> <left> C-M-x <down> <down> C-M-x
M-x r e p o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
cl
aw-replace-buffer-contents-with-svg-images
Making completion list...

Load-path shadows:
/usr/share/emacs/23.2/site-lisp/debian-startup hides 
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/23.2/site-lisp/semi/pgg-pgp5 hides 
/usr/share/emacs/23.2/lisp/pgg-pgp5
/usr/share/emacs/23.2/site-lisp/semi/pgg-gpg hides 
/usr/share/emacs/23.2/lisp/pgg-gpg
/usr/share/emacs/23.2/site-lisp/semi/pgg-parse hides 
/usr/share/emacs/23.2/lisp/pgg-parse
/usr/share/emacs/23.2/site-lisp/flim/sha1 hides 
/usr/share/emacs/23.2/lisp/sha1
/usr/share/emacs/23.2/site-lisp/flim/md4 hides 
/usr/share/emacs/23.2/lisp/md4
/usr/share/emacs/23.2/site-lisp/flim/hex-util hides 
/usr/share/emacs/23.2/lisp/hex-util
/usr/share/emacs/23.2/site-lisp/semi/pgg-def hides 
/usr/share/emacs/23.2/lisp/pgg-def
/usr/share/emacs/23.2/site-lisp/semi/pgg-pgp hides 
/usr/share/emacs/23.2/lisp/pgg-pgp
/usr/share/emacs/23.2/site-lisp/semi/pgg hides 
/usr/share/emacs/23.2/lisp/pgg
/usr/share/emacs/site-lisp/rst hides 
/usr/share/emacs/23.2/lisp/textmodes/rst
/usr/share/emacs/23.2/site-lisp/dictionaries-common/flyspell hides 
/usr/share/emacs/23.2/lisp/textmodes/flyspell
/usr/share/emacs/23.2/site-lisp/dictionaries-common/ispell hides 
/usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs/23.2/site-lisp/flim/sasl hides 
/usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs/23.2/site-lisp/flim/hmac-md5 hides 
/usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs/23.2/site-lisp/flim/sasl-cram hides 
/usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs/23.2/site-lisp/flim/hmac-def hides 
/usr/share/emacs/23.2/lisp/net/hmac-def
/usr/share/emacs/23.2/site-lisp/flim/sasl-ntlm hides 
/usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs/23.2/site-lisp/flim/sasl-digest hides 
/usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs/23.2/site-lisp/flim/ntlm hides 
/usr/share/emacs/23.2/lisp/net/ntlm
/usr/share/emacs/23.2/site-lisp/wl/rfc2368 hides 
/usr/share/emacs/23.2/lisp/mail/rfc2368

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 sha1-el hex-util hashcash mail-utils emacsbug help-mode easymenu
view cl cl-19 tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win
x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind system-font-setting
font-render-setting gtk x-toolkit x multi-tty emacs)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-20 15:40 bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used Anders Waldenborg
@ 2010-05-20 17:16 ` Chong Yidong
  2010-05-20 20:07   ` Anders Waldenborg
  0 siblings, 1 reply; 8+ messages in thread
From: Chong Yidong @ 2010-05-20 17:16 UTC (permalink / raw)
  To: Anders Waldenborg; +Cc: 6230

Anders Waldenborg <anders@0x63.nu> writes:

> By running the command defined by the following:
>
> (require 'cl)
> (defun aw-replace-buffer-contents-with-svg-images ()
>   (interactive)
>   (erase-buffer)
>   (dotimes (N 200)
>     (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))))
>
> the current buffer will be replaced with 200 images. Running xrestop it
> can easily be seen that 200 pixmaps are added to the X11 server every
> time the command is run.
>
> One would expect that the pixmaps were removed from X11 when they don't
> exist in any buffer any longer (which is why recipe uses erase-buffer so
> it can be run multiple times, increasing number of pixmaps every time -
> not the behaviour I expect).
>
> The pixmaps doesn't even go away when the buffer is killed.

You can run (clear-image-cache) to eliminate the image data.  Emacs also
does this automatically, every hundred redisplays.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-20 17:16 ` Chong Yidong
@ 2010-05-20 20:07   ` Anders Waldenborg
  2010-05-20 20:32     ` Chong Yidong
  0 siblings, 1 reply; 8+ messages in thread
From: Anders Waldenborg @ 2010-05-20 20:07 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 6230

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-20 20:07   ` Anders Waldenborg
@ 2010-05-20 20:32     ` Chong Yidong
  2010-05-21  6:37       ` Anders Waldenborg
  0 siblings, 1 reply; 8+ messages in thread
From: Chong Yidong @ 2010-05-20 20:32 UTC (permalink / raw)
  To: Anders Waldenborg; +Cc: 6230

Anders Waldenborg <anders@0x63.nu> writes:

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

Oh, yes, I forgot.  There is image-cache-eviction-delay as well.  If you
set this to a sufficiently small number, the test frees the pixmaps as
required.

Is there a specific reason you are interested in this problem?  It's
possible that we need to improve the conditions under which the image
cache is freed, but it's hard to tell unless we have a use-case in mind.
(Obviously, the current system assumes that the rate at which images are
created is much lower than the "usual editing speed".)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-20 20:32     ` Chong Yidong
@ 2010-05-21  6:37       ` Anders Waldenborg
  2010-05-21 17:35         ` Chong Yidong
  0 siblings, 1 reply; 8+ messages in thread
From: Anders Waldenborg @ 2010-05-21  6:37 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 6230

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

On 05/20/2010 10:32 PM, Chong Yidong wrote:
> Oh, yes, I forgot.  There is image-cache-eviction-delay as well.  If you
> set this to a sufficiently small number, the test frees the pixmaps as
> required.

Yes, that works, thanks.

> Is there a specific reason you are interested in this problem?  It's
> possible that we need to improve the conditions under which the image
> cache is freed, but it's hard to tell unless we have a use-case in mind.
> (Obviously, the current system assumes that the rate at which images are
> created is much lower than the "usual editing speed".)

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)

  anders

[-- Attachment #2: vrend.el --]
[-- Type: text/plain, Size: 4640 bytes --]

;;; Beta quality code - use at own risk

;;; Copyright (C) 2010 Anders Waldenborg
;;; I'll add a GPL header or something like that here later...

; We handle the tranformation matrix (but let svg do the actual projection).
; So we need some stuff to handle matrices...

(defconst vrend-2pi (* 8.0 (atan 1.0)))

(defun vrend--mtx-col (mtx col)
  "Get column col in matrix mtx"
  (mapcar '(lambda (v) (aref v col)) mtx))

(defun vrend--mtx-row (mtx row)
  "Get row row in matrix mtx"
  (mapcar 'identity (aref mtx row)))

(defun vrend--mtx-ref (i j)
  (aref (aref vrend--curr-mtx i) j))

(defun vrend--dotprod (l r)
  "dot product of l and r"
  (if (or l r)
      (+ (* (car l) (car r)) (vrend--dotprod (cdr l) (cdr r)))
    0))

(defun vrend--mtx-mul3x3 (l r)
  `[[,(vrend--dotprod (vrend--mtx-row l 0) (vrend--mtx-col r 0)) ,(vrend--dotprod (vrend--mtx-row l 0) (vrend--mtx-col r 1)) ,(vrend--dotprod (vrend--mtx-row l 0) (vrend--mtx-col r 2))]
    [,(vrend--dotprod (vrend--mtx-row l 1) (vrend--mtx-col r 0)) ,(vrend--dotprod (vrend--mtx-row l 1) (vrend--mtx-col r 1)) ,(vrend--dotprod (vrend--mtx-row l 1) (vrend--mtx-col r 2))]
    [,(vrend--dotprod (vrend--mtx-row l 2) (vrend--mtx-col r 0)) ,(vrend--dotprod (vrend--mtx-row l 2) (vrend--mtx-col r 1)) ,(vrend--dotprod (vrend--mtx-row l 2) (vrend--mtx-col r 2))]])

(defun vrend--mtx-translate (dx dy)
  "translationmatrix for dx dy"
  `[[1.0 0.0 ,dx]
    [0.0 1.0 ,dy]
    [0.0 0.0 1.0]])

(defun vrend--mtx-rotate (rot)
  ""
  `[[,(cos rot) ,(- (sin rot)) 0.0]
    [,(sin rot)  ,(cos rot)     0.0]
    [       0.0         0.0    1.0]])

(defun vrend--mtx-scale (sx sy)
  ""
  `[[,sx 0.0 0.0]
    [0.0 ,sy 0.0]
    [0.0 0.0 1.0]])

(defun vrend--mtx-ident ()
  ""
  [[1.0 0.0 0.0]
   [0.0 1.0 0.0]
   [0.0 0.0 1.0]])

(defun vrend-path-start (x y)
  (setq vrend--curr-path nil)
  (vrend-path-moveto x y))

(defun vrend-path-moveto (x y)
  (add-to-list 'vrend--curr-path (list ?M x y)))

(defun vrend-path-lineto (x y)
  (add-to-list 'vrend--curr-path (list ?L x y)))

(defun vrend-path-close ()
  (add-to-list 'vrend--curr-path (list ?Z)))

(defun vrend-rotate (deg)
  (setq vrend--curr-mtx (vrend--mtx-mul3x3 vrend--curr-mtx (vrend--mtx-rotate deg))))

(defun vrend-scale (sx sy)
  (setq vrend--curr-mtx (vrend--mtx-mul3x3 vrend--curr-mtx (vrend--mtx-scale (float sx) (float sy)))))

(defun vrend-translate (dx dy)
  (setq vrend--curr-mtx (vrend--mtx-mul3x3 vrend--curr-mtx (vrend--mtx-translate (float dx) (float dy)))))

(defun vrend--render-path-element (e)
  (format "%c %s" (car e) (mapconcat '(lambda (x) (format "%f" x)) (cdr e) " ")))

(defun vrend--render-path ()
  (insert " d=\"" (mapconcat 'vrend--render-path-element (reverse vrend--curr-path) " ") "\""))

(defun vrend--render-transform ()
  (insert (format " transform=\"matrix(%f %f %f %f %f %f)\"" (vrend--mtx-ref 0 0) (vrend--mtx-ref 1 0) (vrend--mtx-ref 0 1) (vrend--mtx-ref 1 1) (vrend--mtx-ref 0 2) (vrend--mtx-ref 1 2))))

(defun vrend-path-stroke ()
  (insert "  <path")
  (vrend--render-path)
  (vrend--render-transform)
  (insert " fill=\"none\"")
  (insert " stroke=\"" (car vrend--curr-strokestyle) "\"")
  (insert " stroke-width=\"0.04\"")
  (insert " />\n"))

(defmacro vrend-with-saved-matrix (&rest body)
  (declare (indent 0) (debug t))
  `(let ((vrend-with-saved-matrix-saved-matrix vrend--curr-mtx))
     (progn
       ,@body
       (setq vrend--curr-mtx vrend-with-saved-matrix-saved-matrix))))

(defmacro vrend (width height coordinatetype &rest body)
  (declare (indent 3) (debug t))
  (let ((width (eval width))
	(height (eval height)))
  `(with-temp-buffer
      (set (make-local-variable 'vrend--curr-mtx) (vrend--mtx-ident))
      (set (make-local-variable 'vrend--curr-path) nil)
      (set (make-local-variable 'vrend--curr-strokestyle) '("black" :width 1))
      (set (make-local-variable 'vrend--curr-fillstyle) nil)

      (insert "<?xml version=\"1.0\" standalone=\"no\"?>\n"
	      "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n"
	      "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"
	      (format "<svg width=\"%d\" height=\"%d\"\n" ,width ,height)
	      "     xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n")


      (when ,coordinatetype
	(vrend-translate ,(/ width 2) ,(/ height 2))

	(when (eq ,coordinatetype '1x1fit)
	  (let ((smalldir ,(min width height)))
	    (vrend-scale (/ smalldir 2.0) (/ smalldir 2.0))))

	(when (eq ,coordinatetype '1x1square)
	  (vrend-scale ,(/ width 2.0) ,(/ height 2.0)))

	(vrend-scale -1.0 -1.0))

      (progn
	,@body)

      (insert "</svg>\n")
      (create-image (buffer-string) nil t)
      )))

(provide 'vrend)

[-- Attachment #3: vrend-example-clock.el --]
[-- Type: text/plain, Size: 2526 bytes --]

;;; Beta quality code - use at own risk

;;; Copyright (C) 2010 Anders Waldenborg
;;; I'll add a GPL header or something like that here later...

;;; Small example on how to use vrend.

;;; Defines the command vrend-clock which creates a new buffer,
;;; Make sure you resize the window/frame and stuff like that.

(require 'cl)
(require 'vrend)

(defun vrend-clock-update-buffer (buf)
  (let ((win (get-buffer-window buf t)))
    (when win
      (let* ((X (window-inside-pixel-edges win))
	     (w (- (car (cddr X)) (car X)))
	     (h (- (cadr (cddr X)) (cadr X))))
	(with-current-buffer buf
	  (erase-buffer)
	  (insert-image (vrend w h '1x1fit

			  ;; Make hour markers...
			  (vrend-path-start 0.0 0.8)
			  (vrend-path-lineto 0.0 0.9)
			  (vrend-path-close)

			  ;; ...12 of them
			  (loop for D from 0 to 11 by 1
				do (vrend-with-saved-matrix
				     (vrend-rotate (* D (/ vrend-2pi 12)))
				     (vrend-path-stroke)))

			  ;; and arrows
			  (let* ((ct (current-time))
				 (T (decode-time ct))
				 (h (nth 2 T))
				 (m (nth 1 T))
				 (s (nth 0 T))
				 (ms (/ (nth 2 ct) 1000))
				 (seconds-since-midnight (+ (* (+ (* h 60) m) 60) s))
				 (seconds-since-hour (+ (* m 60) s))
				 (ms-since-minute (+ ms (* s 1000))))
			    (vrend-with-saved-matrix
			      (vrend-path-start 0.0 0.0)
			      (vrend-path-lineto -0.05 0.4)
			      (vrend-path-lineto 0.0 0.6)
			      (vrend-path-lineto 0.05 0.4)
			      (vrend-path-close)
			      (vrend-rotate (* seconds-since-midnight (/ vrend-2pi (* 60 60 12))))
			      (vrend-path-stroke))
			    (vrend-with-saved-matrix
			      (vrend-path-start 0.0 0.0)
			      (vrend-path-lineto -0.05 0.3)
			      (vrend-path-lineto 0.0 0.90)
			      (vrend-path-lineto 0.05 0.3)
			      (vrend-path-close)
			      (vrend-rotate (* seconds-since-hour (/ vrend-2pi (* 60 60))))
			      (vrend-path-stroke))
			    (vrend-with-saved-matrix
			      (vrend-path-start 0.0 0.0)
			      (vrend-path-lineto 0.0 0.90)
			      (vrend-path-close)
			      (vrend-rotate (* ms-since-minute (/ vrend-2pi 60000.0)))
			      (vrend-path-stroke))))))))))

(defun vrend-kill-buffer-hook ()
  (cancel-timer vrend-clock-timer))

(defun vrend-clock ()
  (interactive)
  (with-current-buffer (generate-new-buffer "*aw-clock*")
    (set-window-buffer nil (current-buffer))
    (make-local-variable 'vrend-clock-timer)
    (add-hook 'kill-buffer-hook 'vrend-kill-buffer-hook nil t)

    (setq vrend-clock-timer (run-at-time nil 0.1 'vrend-clock-update-buffer (current-buffer)))))


^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-21  6:37       ` Anders Waldenborg
@ 2010-05-21 17:35         ` Chong Yidong
  2010-05-21 20:12           ` Stefan Monnier
  2010-05-21 20:43           ` Anders Waldenborg
  0 siblings, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2010-05-21 17:35 UTC (permalink / raw)
  To: Anders Waldenborg; +Cc: 6230

Anders Waldenborg <anders@0x63.nu> 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.)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-21 17:35         ` Chong Yidong
@ 2010-05-21 20:12           ` Stefan Monnier
  2010-05-21 20:43           ` Anders Waldenborg
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2010-05-21 20:12 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Anders Waldenborg, 6230

> be removed from memory.  (We should probably rename `image-refresh' to
> `image-uncache' or something like that.)

I think the traditional name would be "image-flush".


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used
  2010-05-21 17:35         ` Chong Yidong
  2010-05-21 20:12           ` Stefan Monnier
@ 2010-05-21 20:43           ` Anders Waldenborg
  1 sibling, 0 replies; 8+ messages in thread
From: Anders Waldenborg @ 2010-05-21 20:43 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 6230

On 05/21/2010 07:35 PM, Chong Yidong wrote:
> 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.

Excellent. Thanks for your assistance!

  anders





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-05-21 20:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-20 15:40 bug#6230: 23.2; Pixmaps kept in X11 after (svg?) images no longer are used Anders Waldenborg
2010-05-20 17:16 ` Chong Yidong
2010-05-20 20:07   ` Anders Waldenborg
2010-05-20 20:32     ` Chong Yidong
2010-05-21  6:37       ` Anders Waldenborg
2010-05-21 17:35         ` Chong Yidong
2010-05-21 20:12           ` Stefan Monnier
2010-05-21 20:43           ` Anders Waldenborg

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).