GNU bug report logs -
#6230
23.2; Pixmaps kept in X11 after (svg?) images no longer are used
Previous Next
Reported by: Anders Waldenborg <anders <at> 0x63.nu>
Date: Thu, 20 May 2010 15:51:02 UTC
Severity: normal
Found in version 23.2
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6230 in the body.
You can then email your comments to 6230 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Thu, 20 May 2010 15:51:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Anders Waldenborg <anders <at> 0x63.nu>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 20 May 2010 15:51:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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)
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Thu, 20 May 2010 17:17:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 6230 <at> debbugs.gnu.org (full text, mbox):
Anders Waldenborg <anders <at> 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.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Thu, 20 May 2010 20:08:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 6230 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Thu, 20 May 2010 20:33:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 6230 <at> debbugs.gnu.org (full text, mbox):
Anders Waldenborg <anders <at> 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".)
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Fri, 21 May 2010 06:39:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 6230 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[vrend.el (text/plain, attachment)]
[vrend-example-clock.el (text/plain, attachment)]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Fri, 21 May 2010 17:36:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 6230 <at> debbugs.gnu.org (full text, mbox):
Anders Waldenborg <anders <at> 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.)
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Fri, 21 May 2010 20:13:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 6230 <at> debbugs.gnu.org (full text, mbox):
> 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
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6230
; Package
emacs
.
(Fri, 21 May 2010 20:44:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 6230 <at> debbugs.gnu.org (full text, mbox):
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
bug closed, send any further explanations to Anders Waldenborg <anders <at> 0x63.nu>
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> debbugs.gnu.org
.
(Sat, 22 May 2010 16:49:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 20 Jun 2010 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 61 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.