emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory leak in gtk emacs when menu-bar-mode is on


From: Satyaki Das
Subject: Memory leak in gtk emacs when menu-bar-mode is on
Date: Thu, 30 Jan 2003 01:41:55 -0800

I have come across a memory leak when menubars are active with
GTK. To see it in action, edit the suitable-directory variable in
the attached leak.el and byte-compile it. Then start two copies
emacs with:
  emacs -q --no-site-file -l leak.elc

In one copy disable both the menubar and toolbar. In the other
disable only the toolbar. Now run,
  M-x find-loop
in both copies.

After some time, the memory consumption of the copy without the
menubar stabilizes at about 11MB. The memory consumption of the
copy with the menubar increases slowly but steadily to about 50MB
after approximately five hours at which point I killed the
process. [Memory size is what top reports]

I have also tried building Emacs without GTK, and there isn't any
leak in that case.

Recently we have added speedbar support for MH-E. One feature of
this is that the user's mail directory is checked periodically and
folders with unread messages are highlighted (like biff). I came
across the leak when running this. In fact the loop is a
simplified version of that found in mh-speed.el.

How should I go about debugging this?
Satyaki


-- leak.el --

;; For me, 
;;   find /home/satyaki/Mail -type d -print | wc -l
;; produces 125.
(defvar suitable-directory "/home/satyaki/Mail")

(defvar find-process nil)
(defvar find-partial-line "")

(defun find-loop ()
  (interactive)
  (save-excursion
    (set-buffer (get-buffer-create "*find-output*"))
    (buffer-disable-undo))
  (run-at-time
   nil 1
   (lambda ()
     (unless (and (processp find-process)
                  (not (eq (process-status find-process) 'exit)))
       (save-excursion
         (set-buffer (get-buffer-create "*find-output*"))
         (erase-buffer))
       (setq find-process (start-process "*find*" nil "find" suitable-directory
                                       "-type" "d" "-print"))
       (set-process-filter find-process 'find-print-output)))))

(defun find-print-output (process output)
  (let ((prevailing-match-data (match-data))
        (position 0)
        line line-end)
    (unwind-protect
        (while (setq line-end (string-match "\n" output position))
          (setq line (concat find-partial-line
                             (substring output position line-end))
                find-partial-line "")
          (save-excursion
            (set-buffer "*find-output*")
            (insert line "\n")
            (display-buffer (current-buffer) t))
          (setq position (1+ line-end)))
      (set-match-data prevailing-match-data))
    (setq find-partial-line (substring output position))))

-- end of leak.el --

Here are some more details about my system. I will be glad to
provide more info if that would be helpful.

Redhat GNU/Linux 8.0
gtk version:  2.0.6-8
glib version: 2.0.6-2
Emacs: checked out from CVS head on Jan 29, 2003.


In GNU Emacs 21.3.50.30 (i686-pc-linux-gnu)
 of 2003-01-29 on troodon
configured using `configure '--with-gtk''

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
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t




reply via email to

[Prev in Thread] Current Thread [Next in Thread]