unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Russell Adams <RLAdams@AdamsInfoServ.Com>
To: 43389@debbugs.gnu.org
Subject: bug#43389: 28.0.50; Emacs memory leaks
Date: Thu, 26 Nov 2020 16:42:19 +0100	[thread overview]
Message-ID: <20201126154219.GA16802@maokai> (raw)
In-Reply-To: <20200917204704.GA20217@maokai>

On Thu, Sep 17, 2020 at 10:47:04PM +0200, Russell Adams wrote:
> From Emacs memory-usage package:
>
> Garbage collection stats:
> ((conses 16 1912248 251798) (symbols 48 54872 19) (strings 32 327552 81803) (string-bytes 1 12344346) (vectors 16 158994) (vector-slots 8 2973919 339416) (floats 8 992 4604) (intervals 56 182607 7492) (buffers 1000 195))
>
>  =>	29.2MB (+ 3.84MB dead) in conses
> 	2.51MB (+ 0.89kB dead) in symbols
> 	10.00MB (+ 2.50MB dead) in strings
> 	11.8MB in string-bytes
> 	2.43MB in vectors
> 	22.7MB (+ 2.59MB dead) in vector-slots
> 	7.75kB (+ 36.0kB dead) in floats
> 	9.75MB (+  410kB dead) in intervals
> 	 190kB in buffers
>
> Total in lisp objects: 97.9MB (live 88.5MB, dead 9.36MB)

I had the memory leak occur again and this time I had the
glibc-malloc-trace-utils loaded and running from the start.

So my emacs grew to 8GB in RAM, and what was curious is if it was a
background task (not window focused on an emacsclient), then the
memory stayed the same. When I had the window focused, I could watch
the memory constantly increasing in htop a few megs at a time.

Garbage collection stats:
((conses 16 1749077 1176908)
 (symbols 48 47530 38)
 (strings 32 307123 144020)
 (string-bytes 1 10062511)
 (vectors 16 113172)
 (vector-slots 8 2105205 486800)
 (floats 8 709 1719)
 (intervals 56 174593 44804)
 (buffers 1000 71))

 =>	26.7MB (+ 18.0MB dead) in conses
	2.18MB (+ 1.78kB dead) in symbols
	9.37MB (+ 4.40MB dead) in strings
	9.60MB in string-bytes
	1.73MB in vectors
	16.1MB (+ 3.71MB dead) in vector-slots
	5.54kB (+ 13.4kB dead) in floats
	9.32MB (+ 2.39MB dead) in intervals
	69.3kB in buffers

Total in lisp objects:  103MB (live 75.0MB, dead 28.5MB)

Buffer ralloc memory usage:
47 buffers
3.36MB total ( 232kB in gaps)
      Size	Gap	Name

    926626	1504	AIS.org
    690050	1933	Personal.org
    553850	2000	Abuffer.org
    490398	3851	*Packages*
    215653	2000	KB.org
     76686	1708	X230.org
     59841	2123	Agenda.org
     51375	51076	*sly-events for sbcl*
     51060	1902	ASC.org
     44596	2000	Contacts.org
     36825	1792	*Messages*
     23882	2309	*org-caldav-debug*
     22867	2000	rgb.lisp
     14678	746	*sly-mrepl for sbcl*
      6640	1173	VirtualFCMap.lisp
      4096	2000	 *code-converting-work*
      3409	16717	 *http orgmode.org:443*
      1946	104	*Org Agenda*
      1528	2028	 *http gaming.demosthenes.org*-491231
      1524	2028	 *http gaming.demosthenes.org*-15349
      1518	2028	 *http gaming.demosthenes.org*
      1276	1368	*sly-inferior-lisp for sbcl*
      1231	2026	 *http gaming.demosthenes.org*-464306
      1208	825	*Help*
       679	1574	*Buffer Details*
       641	1975	 *Agenda Commands*
       531	1494	*Calendar*
       324	2008	 *http melpa.org:443*
       278	3775	*helm M-x*
       185	1838	*org caldav sync result*
       144	2000	*scratch*
        57	21434	*helm find files*
        44	5610	 *icalendar-work*
        30	2000	 *sly-fontify*
        21	2000	*log-edit-files*
        20	0	 *pdf-info-query--escape*
        18	4077	*helm mini*
        12	8630	 *code-conversion-work*
         5	4065	 *Echo Area 1*
         0	2033	 *Minibuf-1*
         0	20	 *Minibuf-0*
         0	20	 *server*
         0	4060	 *Echo Area 0*
         0	61547	 *sly-1*
         0	20	 *sly-dds-1-1*
         0	20	*changes to ~/ASC/Software/Snaps/*
         0	20	*vc*

I started emacs with:

MTRACE_CTL_FILE=mtraceEMACS.mtr LD_PRELOAD=~/software/glibc-malloc-trace-utils/libmtrace.so ~/.local/bin/emacs --daemon >> ~/.config/emacs/emacs.log 2>&1

This created some huge files. By the time I reached 8GB in RAM, the
mtr file for the main process (I think) was 53 GB. I also have little mtrace
files littered everywhere in different project directories.

-rw-r--r--   1 adamsrl adamsrl  53G Nov 26 13:23 mtraceEMACS.mtr.15236
-rw-r--r--   1 adamsrl adamsrl 4.2G Nov 26 13:36 my.wl
-rw-r--r--   1 adamsrl adamsrl 1.3G Nov 26 13:50 mtraceEMACS.mtr.15236.allocs
-rw-r--r--   1 adamsrl adamsrl  32K Nov 26 13:55 mtraceEMACS.mtr.15236.binnedallocs.log
-rw-r--r--   1 adamsrl adamsrl 6.0G Nov 26 15:12 vmrssout
-rw-r--r--   1 adamsrl adamsrl 6.0G Nov 26 15:12 vmout
-rw-r--r--   1 adamsrl adamsrl 8.6G Nov 26 15:12 idealrssout

I converted the mtraceEMACS.mtr.15236 to my.wl using trace2wl.

The trace_run command did this output:

% ~/software/glibc-malloc-trace-utils/trace_run ./my.wl vmout vmrssout idealrssout
11,757,635,230,744 cycles
4,532,472,554 usec wall time
5,966,752,470 usec across 3 threads
8,461,721,600 bytes Max RSS (218,308,608 -> 8,680,030,208)
Starting VmRSS 218308608 (bytes)
Starting VmSize 219549696 (bytes)
Starting MaxRSS 218308608 (bytes)
Ending VmRSS 8680030208 (bytes)
Ending VmSize 8903626752 (bytes)
Ending MaxRSS 8680030208 (bytes)
8,131,008 Kb Max Ideal RSS

sizeof ticks_t is 8
Avg malloc time:    145 in 422,186,832 calls
Avg calloc time: 12,538 in  1,164,584 calls
Avg realloc time:   566 in  3,294,165 calls
Avg free time:      110 in 449,397,629 calls
Total call time: 127,318,389,383 cycles

These files are impossible to share around, is there anything I can
run to extract anything else useful from them?

% ~/software/glibc-malloc-trace-utils/trace_statistics mtraceEMACS.mtr.15236
Min allocation size: 0
Max allocation size: 1603869
Mean allocation size: 128

I did follow the instructions for downsampling, but I haven't a clue
what to do in Octave. Is it worth posting those files?

I have the impression this is more about how often more RAM was
requested, and not the source of the call?

I should mention I'm present in #emacs and happy to discuss there.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3





  parent reply	other threads:[~2020-11-26 15:42 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14  0:43 bug#43389: 28.0.50; Emacs memory leaks Michael Heerdegen
2020-09-14 19:09 ` Juri Linkov
2020-09-15  0:32   ` Michael Heerdegen
2020-09-15 17:54     ` Russell Adams
2020-09-15 18:52       ` Eli Zaretskii
2020-09-15 21:12         ` Russell Adams
2020-09-16 14:52           ` Eli Zaretskii
2020-09-17 20:47             ` Russell Adams
2020-09-17 21:58               ` Joshua Branson via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-17 23:09                 ` Russell Adams
2020-09-18  6:56                 ` Eli Zaretskii
2020-09-18  7:53                   ` Robert Pluim
2020-09-18  8:13                     ` Eli Zaretskii
2020-09-20 20:08                     ` jbranso--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-18  8:22               ` Eli Zaretskii
2020-11-09 20:46                 ` Michael Heerdegen
2020-11-09 21:24                   ` Michael Heerdegen
2020-11-09 21:51                     ` Michael Heerdegen
2020-11-10  3:36                       ` Eli Zaretskii
2020-11-10  8:22                         ` Andreas Schwab
2020-11-10 12:59                           ` Michael Heerdegen
2020-11-10 13:01                             ` Andreas Schwab
2020-11-10 13:10                               ` Michael Heerdegen
2020-11-10 13:20                                 ` Eli Zaretskii
2020-11-10 13:26                                   ` Michael Heerdegen
2020-11-10 14:25                                     ` Michael Heerdegen
2020-11-10 15:36                                       ` Eli Zaretskii
2020-11-10 17:44                                         ` Eli Zaretskii
2020-11-10 18:55                                           ` Michael Heerdegen
2020-11-10 15:34                                     ` Eli Zaretskii
2020-11-10 16:49                                       ` Michael Heerdegen
2020-11-10 17:13                                         ` Eli Zaretskii
2020-12-08  1:07                                         ` Michael Heerdegen
2020-12-08  3:24                                           ` Jose A. Ortega Ruiz
2020-12-08 12:37                                             ` Russell Adams
2020-12-08  5:13                                           ` Jean Louis
2020-12-08 16:29                                             ` Michael Heerdegen
2020-12-10  0:50                                               ` Michael Heerdegen
2020-12-10  5:43                                                 ` Jean Louis
2020-11-10 15:53                           ` Eli Zaretskii
2020-11-10 10:25                         ` Michael Heerdegen
2020-11-10 15:55                           ` Eli Zaretskii
2020-11-10 16:41                             ` Michael Heerdegen
2020-11-09 22:33                   ` Jean Louis
2020-11-10 15:47                     ` Eli Zaretskii
2020-11-10 16:36                       ` Michael Heerdegen
2020-11-10 19:51                       ` Jean Louis
2020-11-10  3:30                   ` Eli Zaretskii
2020-11-26 15:42               ` Russell Adams [this message]
2020-11-26 16:34                 ` Eli Zaretskii
2020-11-26 16:54                   ` Russell Adams
2020-11-26 19:20                     ` Eli Zaretskii
2020-11-27 10:45                       ` Russell Adams
2020-11-27 12:38                         ` Eli Zaretskii
2020-11-28 19:56                           ` Russell Adams
2020-11-28 20:13                             ` Eli Zaretskii
2020-11-28 21:52                               ` Basil L. Contovounesios
2020-11-29  3:29                                 ` Eli Zaretskii
2020-09-17 20:59 ` Thomas Ingram
2020-10-29 20:17 ` Trevor Bentley
2020-10-30  8:00   ` Eli Zaretskii
2020-11-11 21:15     ` Trevor Bentley
2020-11-12 14:24       ` Eli Zaretskii
2020-11-16 20:16         ` Eli Zaretskii
2020-11-16 20:42           ` Florian Weimer
2020-11-17 15:45             ` Eli Zaretskii
2020-11-17 16:32               ` Carlos O'Donell
2020-11-17 17:13                 ` Eli Zaretskii
2020-11-17 17:20                   ` DJ Delorie
2020-11-17 19:52                     ` Eli Zaretskii
2020-11-17 19:59                       ` DJ Delorie
2020-11-17 20:13                         ` Florian Weimer
2020-11-17 20:16                           ` DJ Delorie
2020-11-17 20:27                             ` Eli Zaretskii
2020-11-17 20:35                               ` Florian Weimer
2020-11-17 20:43                                 ` Eli Zaretskii
2020-11-17 20:58                                   ` Florian Weimer
2020-11-17 21:10                                     ` Eli Zaretskii
2020-11-18  5:43                                       ` Carlos O'Donell
2020-11-18  6:09                                         ` Jean Louis
2020-11-18  8:32                                           ` Andreas Schwab
2020-11-18  9:01                                             ` Jean Louis
2020-11-18 16:19                                               ` Russell Adams
2020-11-18 17:30                                                 ` Eli Zaretskii
2020-11-19 15:57                                             ` Carlos O'Donell
2020-11-18 18:01                                         ` Eli Zaretskii
2020-11-18 18:27                                           ` DJ Delorie
2020-11-19 16:08                                             ` Carlos O'Donell
2020-11-22 20:19                                               ` Deus Max
2020-11-23  3:26                                                 ` Eli Zaretskii
2020-11-23 16:45                                                   ` Deus Max
2020-11-23 17:07                                                     ` Eli Zaretskii
2020-11-17 16:33               ` Florian Weimer
2020-11-17 17:08                 ` Eli Zaretskii
2020-11-17 17:24                   ` Florian Weimer
2020-11-17 20:39                   ` Jean Louis
2020-11-17 20:57                     ` DJ Delorie
2020-11-17 21:45                       ` Jean Louis
2020-11-18 15:03                         ` Eli Zaretskii
2020-11-23 18:55                           ` Jean Louis
     [not found]         ` <87wnyju40z.fsf@mail.trevorbentley.com>
2020-11-17 20:36           ` Eli Zaretskii
2020-11-18 21:47 ` Jose A. Ortega Ruiz
2020-11-19 14:03   ` Eli Zaretskii
2020-11-19 14:34     ` Jean Louis
2020-11-19 16:03       ` Carlos O'Donell
2020-11-19 17:25     ` jao
2020-12-09 19:41 ` Jose A. Ortega Ruiz
2020-12-09 20:25   ` Lars Ingebrigtsen
2020-12-09 21:04     ` Jose A. Ortega Ruiz
2020-12-11 13:55       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201126154219.GA16802@maokai \
    --to=rladams@adamsinfoserv.com \
    --cc=43389@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).