From: John Wiseman

Subject: emacs/eli memory leak?

Date: 2001-11-6 14:40


I am using GNU Emacs 20.3.1 (i386-*-windows955.0), ACL 6.0, and the
emacs lisp interface that came with ACL 6.0 under Windows 2000.

I was wondering whether anyone else has noticed an apparent memory
leak in emacs related to the modeline run status that is reported by
ACL (The one that says "Idle", "GC" or "Run").

If I start up ACL in emacs, and run the following function (compiled):

  (defun run-boredom-test ()
    (let ((x 0)
          (c nil))
      (dotimes (i 10000000000000)
        (setf c (cons x x))
        (setf x (+ x 1)))
      x))

I can watch emacs eat memory at a rate of roughly 12KB / second
(though during one run of an hour or two I saw emacs expand by about
400 MB, so that rate may not be constant).  I also see the modeline
status flicker rapidly between "Run" and "GC".

If I do either one of the following
  
  i) remove the "(setf c (cons x x))" from the above function (so that
  no garbage is generated, so garbage collection isn't run, so the
  modeline never changes from "Run")

  ii) remove fi::install-mode-line-run-status and fi:show-run-status
  as hooks in emacs, so that the modeline doesn't show lisp status at
  all

Then I can run the above function without seeing emacs leak memory.

Has anyone else noticed this or have any ideas what might be causing
it?

I'm not an emacs expert, but it looks like this is the only code
that runs on the emacs side when the modeline changes:

  (defun fi::show-run-status-filter (proc string)
    (let ((len (length string)))
      (if (> len 4)
  	(setq string (substring string (- len 4)))))
    (setq fi:allegro-run-status-string string)
    ;; Force redisplay of all buffers' mode lines to be considered.
    (save-excursion (set-buffer (other-buffer)))
    (set-buffer-modified-p (buffer-modified-p))
    ;; Do redisplay right now, if no input pending.
    (sit-for 0))

Nothing too suspicious looking there.


Thanks,
John Wiseman