[Top][All Lists]

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

Emacs memory management and sluggishness

From: Óscar Fuentes
Subject: Emacs memory management and sluggishness
Date: Fri, 26 Jul 2019 21:20:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

[I sent this message through gmane hours ago and so far it was not
posted, sorry for the duplicate if it finally arrives]

GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit) of

M-x emacs-runtime says this session is running for 26 days. Light usage.
Right now its RSS is 1.1 GB. I don't open huge files (rarely they are
larger than 200 KB, except for Gnus (?) opening sent-news and sent-mail,
which are about 5MB each). Sometimes I read PDF documents with
PDF-Tools, which amounts to an image-viewer plus the length of the PDF
file, being the largest one 6 MB.

Since a week or two typing normal text (i.e. writing this message) even
in Fundamental Mode shows an annoying lag betwenn the keypress and the
character showing on the screen. Sometimes it affects entire key
sequences, and I'm no fast typist.

So my questions are: do we have a problem with memory fragmentation?
because with the same usage pattern the memory keeps growing.

And could this cause the lag I described above? At this moment, simply
typing text makes Emacs CPU usage go over 50% of a core (on a fast
desktop machine). This does not happen on a fresh instance with the same
configuration. I see the lag increases on correlation with the memory
increase. Apart from Evil-mode, I have no other edition-related modes
apart from what Emacs itself activates, and disabling Evil makes no

P.S.: profiling indicates that about 80% of the CPU samples are on
Automatic GC. Maybe the cause is running the GC over such large memory

(garbage-collect) returns

((conses 16 4505904 1124616)
 (symbols 48 76877 18)
 (strings 32 340997 83083)
 (string-bytes 1 10456288)
 (vectors 16 688370)
 (vector-slots 8 24140524 2173062)
 (floats 8 1621 1825)
 (intervals 56 112123 94665)
 (buffers 992 449))

I wonder how this ends using 1.1 GB of RSS.

(memory-limit) returns

1874140 (#o7114334, #x1c98dc)

(memory-use-counts) returns

(3617372752 2210912 8232217138 506599 2689836943 19615159 67629016)

gc-elapsed returns


htop says that emacs used 2h38m of CPU so far.

reply via email to

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