Subject: bug#26530: Emacs 24.5, 25; Lisp Interpreter Bug

From: Cody Rivera <[email-masked]>
Date: Sat, 15 Apr 2017 21:49:57 -0500

Emacs freezes and leaks memory when I eval the following code from a fresh
startup ("works" in both ielm and *scratch*)

(setq i 1)

(loop
 (setq i (+ i 1))
 (print i))

It occupies more and more memory, and can only be stopped by sending a
termination signal to the process.

Although I discovered this behavior in Debian's version 24.5 on GNU/Linux,
I have been able to replicate it in stock version 25.

The extent of the memory leak is such that the acronym EMACS ends up
expanding to "Eight thousand Megabytes And Constantly Swapping".

The following is information from Emacs's built in bug reporting system

--------------------------------------------------------------------------------------------------------

In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2016-03-19 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:    Debian GNU/Linux 8.7 (jessie)

Configured using:
 `configure --build x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Outline

Minor modes in effect:
  goto-address-mode: t
  tooltip-mode: t
  electric-indent-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-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t
  view-mode: t

Recent messages:
<mouse-6> is undefined [49 times]
byte-code: End of buffer [10 times]
<mouse-6> is undefined
<double-mouse-6> is undefined
byte-code: End of buffer
<mouse-6> is undefined
byte-code: End of buffer [2 times]
<mouse-6> is undefined
byte-code: End of buffer
<mouse-7> is undefined [9 times]

Load-path shadows:
/usr/share/emacs/site-lisp/golang-mode/go-mode hides
/usr/share/emacs/24.5/site-lisp/golang-mode/go-mode
/usr/share/emacs/site-lisp/golang-mode/go-mode-load hides
/usr/share/emacs/24.5/site-lisp/golang-mode/go-mode-load
/usr/share/emacs/24.5/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides
/usr/share/emacs/24.5/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/24.5/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/24.5/lisp/textmodes/ispell
/usr/share/emacs/24.5/lisp/emacs-lisp/cl-lib hides
/usr/share/emacs/24.5/site-lisp/slime/lib/cl-lib
/usr/share/emacs/24.5/lisp/emacs-lisp/ert-x hides
/usr/share/emacs/24.5/site-lisp/slime/lib/ert-x
/usr/share/emacs/24.5/lisp/emacs-lisp/ert hides
/usr/share/emacs/24.5/site-lisp/slime/lib/ert

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils misearch multi-isearch goto-addr
thingatpt noutline outline view debian-el debian-el-loaddefs
slime-autoloads cl-macs haskell-mode-autoloads edmacro kmacro cl gv
cl-loaddefs cl-lib go-mode-load emacs-goodies-el emacs-goodies-custom
emacs-goodies-loaddefs easy-mmode devhelp time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
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
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 90947 5694)
 (symbols 48 19180 0)
 (miscs 40 126 338)
 (strings 32 13692 4629)
 (string-bytes 1 425984)
 (vectors 16 10243)
 (vector-slots 8 393157 8288)
 (floats 8 67 474)
 (intervals 56 967 10)
 (buffers 960 12)
 (heap 1024 33451 962))