Subject: Re: bug#43389: 28.0.50; Emacs memory leaks using hard disk all time

From: Jean Louis <[email-masked]>
Date: Thu, 26 Nov 2020 12:09:32 +0300

Hello Eli,

Here is short report on the behavior:

Emacs uptime: 2 days, 19 hours, 46 minutes, 49 seconds

I think it was 11:12 o'clock my time zone. I was not doing nothing
special just writing emails and invoking emacsclient. All the time
before the swap shown by symon-mode was just about 200 MB suddenly it
grew to large number maybe few gigabytes, hard disk started working
heavily. It became all very slow but I could write letters.

I have tried to invoke M-x good-bye around 11:12, that is where it
became all very slow and started working with hard disk. Almost
everything blocked on screen. Emacs was kind of empty, no menus,
nothing, just blank black background, no mode line. So I moved it to
other workspace and continued working with zile.

About 36 minutes later it finally wrote this information into file:

((uptime "2 days, 18 hours, 32 minutes, 32 seconds") (pid 13339) (garbage ((conses 16 4438358 789442) (symbols 48 86924 25) (strings 32 571988 149785) (string-bytes 1 25104928) (vectors 16 245282) (vector-slots 8 4652918 1622184) (floats 8 1860 19097) (intervals 56 645336 37479) (buffers 992 900))) (buffers-size 200839861) (vsize (vsize 5144252)))

There after few minutes I have invoked the good-bye again:

((uptime "2 days, 18 hours, 35 minutes, 19 seconds") (pid 13339) (garbage ((conses 16 4511014 617524) (symbols 48 86926 23) (strings 32 576134 114546) (string-bytes 1 25198549) (vectors 16 245670) (vector-slots 8 4636183 1560354) (floats 8 1859 18842) (intervals 56 655325 24178) (buffers 992 900))) (buffers-size 200898858) (vsize (vsize 5144252)))

But what happened after 36 minutes of waiting is that Emacs became
responsive. So I am still running this session and I hope to get
mtrace after the session has finished.

Before I was not patient longer than maybe 3-5 minutes and I have
aborted Emacs. But now I can see it stabilized after hard work with
memory or whatever it was doing. Swap is 1809 MB and vsize just same
as above.

Observation on "what I was doing when vsize started growing" is
simple, I was just editing email, nothing drastic. I did not do
anything special.

If you say I should finish session now and send the mtrace, I can do
it.

Jean

(defun good-bye ()
  (interactive)
  (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)))