[Top][All Lists]

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

bug#43389: 28.0.50; Emacs memory leaks

From: Jean Louis
Subject: bug#43389: 28.0.50; Emacs memory leaks
Date: Mon, 23 Nov 2020 21:55:57 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Eli Zaretskii <eliz@gnu.org> [2020-11-18 18:04]:
> > Date: Wed, 18 Nov 2020 00:45:48 +0300
> > From: Jean Louis <bugs@gnu.support>
> > Cc: eliz@gnu.org, fweimer@redhat.com, trevor@trevorbentley.com,
> >   michael_heerdegen@web.de, carlos@redhat.com, 43389@debbugs.gnu.org
> > 
> > Maybe some simple new and automatic function could be temporarily
> > included to spit errors to output on what is Emacs doing when it
> > starts swapping (if it is swapping), then such errors could at least
> > be captured in a file even if I have to reboot computer.

I use now M-x vsize-with-timer for 2GB and M-x good-bye to capture
that basic data.

(defun vsize-value ()
  (let* ((attributes (process-attributes (emacs-pid)))
         (vsize-name (car (elt attributes 5)))
         (vsize-value (cdr (elt attributes 5))))
    (list vsize-name vsize-value)))

(defun vsize-check (&optional gb)
  (let* ((vsize (cadr (vsize-value)))
         (gb (or gb 2))
         (gb-1 1048576.0)
         (gb (* gb gb-1)))
    (when (> vsize gb)
        (message "vsize: %.02fG" (/ vsize gb-1)))))

(defun vsize-with-timer (gb)
  (interactive "nGiB: ")
  (let ((timer (run-with-timer 1 30 'vsize-check gb)))
    (message "Timer: %s" timer)))

(defun good-bye ()
  (let* ((garbage (garbage-collect))
         (size 0)
         (buffers-size (dolist (buffer (buffer-list) size)
                        (setq size (+ size (buffer-size buffer)))))
         (uptime (emacs-uptime))
         (pid (emacs-pid))
         (vsize (vsize-value))
         (file (format "~/tmp/emacs-session-%s.el" pid))
         (list (list (list 'uptime uptime) (list 'pid pid)
                     (list 'garbage garbage) (list 'buffers-size buffers-size)
                     (list 'vsize vsize))))
    (with-temp-file file
      (insert (prin1-to-string list)))
    (message file)))

reply via email to

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