Subject: 23.0.60; Emacs goes in a malloc loop

From: Ashish Shukla <[email-masked]>
Date: Mon, 22 Dec 2008 03:51:01 +0530 (IST)

Following is the piece of Emacs Lisp code, which I tried to execute in
Emacs's *scratch* buffer to close all buffers except the buffer named
"buffer-name".

,----
| (dolist (buffer (buffer-list))
|         (unless (string-match "buffer-name" (buffer buffer))
|                 (kill-buffer buffer)))
`----

Executing above Emacs Lisp code increases CPU usage and Emacs keeps on
allocating memory. This bug is reproducible always.

(gdb) bt
#0  0x0000003b2866d295 in _int_malloc (av=<value optimized out>, bytes=<value optimized out>) at ma
lloc.c:4488
#1  0x0000003b2866e4f5 in *__GI___libc_malloc (bytes=<value optimized out>) at malloc.c:3549
#2  0x0000000000520ee3 in xrealloc (block=<value optimized out>, size=4240) at alloc.c:784
#3  0x0000000000410fae in adjust_glyph_matrix (w=0xe97af0, matrix=0x2bc68c0, x=0, y=0, dim={width =
 4, height = 0}) at dispnew.c:751
#4  0x00000000004174fe in allocate_matrices_for_window_redisplay (w=0xe97af0) at dispnew.c:2068
#5  0x0000000000417b79 in adjust_frame_glyphs (f=0xd2a1a0) at dispnew.c:2408
#6  0x0000000000417d2f in adjust_glyphs (f=0x3b28935ff0) at dispnew.c:2091
#7  0x0000000000454927 in enlarge_window (window=15590164, delta=0, horiz_flag=0) at window.c:4293
#8  0x000000000044096f in resize_mini_window (w=0xede310, exact_p=1) at xdisp.c:8756
#9  0x0000000000432e1c in with_echo_area_buffer (w=0xede310, which=<value optimized out>, fn=0x4409
b8 <resize_mini_window_1>, a1=15590160, a2=10873329, a3=0, a4=0) at xdisp.c:8369
#10 0x00000000004498a9 in resize_echo_area_exactly () at xdisp.c:8615
#11 0x00000000004dc9c3 in command_loop_1 () at keyboard.c:1904
#12 0x0000000000534275 in internal_condition_case (bfun=0x4dc5aa <command_loop_1>, handlers=1096052
9, hfun=0x4d6e8a <cmd_error>) at eval.c:1511
#13 0x00000000004d632c in command_loop_2 () at keyboard.c:1338
#14 0x000000000053436a in internal_catch (tag=<value optimized out>, func=0x4d6312 <command_loop_2>
, arg=10873233) at eval.c:1247
#15 0x00000000004d6cfd in command_loop () at keyboard.c:1317
#16 0x00000000004d7034 in recursive_edit_1 () at keyboard.c:942
#17 0x00000000004d7156 in Frecursive_edit () at keyboard.c:1004
#18 0x00000000004cb2a9 in main (argc=<value optimized out>, argv=0x7fff67dc1e78) at emacs.c:1781

In GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-12-12 on chateau
Windowing system distributor `The X.Org Foundation', version 11.0.10503000
configured using `configure  '--prefix=/usr' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-23' '--infodir=/usr/share/info/emacs-23' '--with-sound' '--with-x' '--with-toolkit-scroll-bars' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xpm' '--with-freetype' '--with-xft' '--with-libotf' '--with-m17n-flt' '--with-x-toolkit=athena' '--without-hesiod' '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus' '--libdir=/usr/lib64' '--build=x86_64-pc-linux-gnu' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu' 'CFLAGS=-O2 -pipe -mtune=nocona -march=nocona -ggdb' 'LDFLAGS=-Wl,--hash-style,both''

Important settings:
  value of $LC_ALL: en_US.UTF-8
  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:
  erc-ring-mode: t
  erc-track-mode: t
  erc-services-mode: t
  erc-notify-mode: t
  erc-networks-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-stamp-mode: t
  erc-smiley-mode: t
  server-mode: t
  display-time-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<menu> r e p o r t - e m a c s - b u g <return>

Recent messages:
Loading ~/.emacs.d/.erc-auth...done
Loading /home/abbe/.emacs.d/elisp/cedet/common/cedet.el (source)...
Setting up CEDET packages...done
Loading /home/abbe/.emacs.d/elisp/cedet/common/cedet.el (source)...done
Loading g...
Loading /home/abbe/.emacs.d/elisp/g-client/g-loaddefs.el (source)...done
Loading /home/abbe/.emacs.d/elisp/g-client/g-cus-load.el (source)...done
Loading g...done
Loading /home/abbe/.emacs.d/elisp/dvc/dvc-load.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Thanks in advance
--
Ashish Shukla