all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Memory leak in gtk emacs when menu-bar-mode is on
@ 2003-01-30  9:41 Satyaki Das
  2003-02-02 19:11 ` Jan D.
  0 siblings, 1 reply; 3+ messages in thread
From: Satyaki Das @ 2003-01-30  9:41 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Memory leak in gtk emacs when menu-bar-mode is on
  2003-01-30  9:41 Memory leak in gtk emacs when menu-bar-mode is on Satyaki Das
@ 2003-02-02 19:11 ` Jan D.
  2003-02-03  0:07   ` Satyaki Das
  0 siblings, 1 reply; 3+ messages in thread
From: Jan D. @ 2003-02-02 19:11 UTC (permalink / raw)
  Cc: emacs-devel

> 
> 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
> 

I've fixed this now.

	Jan D.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Memory leak in gtk emacs when menu-bar-mode is on
  2003-02-02 19:11 ` Jan D.
@ 2003-02-03  0:07   ` Satyaki Das
  0 siblings, 0 replies; 3+ messages in thread
From: Satyaki Das @ 2003-02-03  0:07 UTC (permalink / raw)
  Cc: emacs-devel

Jan D. <jan.h.d@swipnet.se> writes:

> >   emacs -q --no-site-file -l leak.elc
> > 
> 
> I've fixed this now.

Thanks for the quick fix! I checked out the latest CVS and am
happy to report that the leak is now gone.

Satyaki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-03  0:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-30  9:41 Memory leak in gtk emacs when menu-bar-mode is on Satyaki Das
2003-02-02 19:11 ` Jan D.
2003-02-03  0:07   ` Satyaki Das

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.