Subject: bug#34320: Emacs 26.1: RAM does not get released after quitting Emacs

From: René Kuligowski <[email-masked]>
Date: Mon, 04 Feb 2019 20:32:44 -0100

Good morning,

I just noticed something which I thought might be interesting, and which 
I stumbled across by watching my conky window's memory watcher (issuing 
'free' and 'vmstat' on the console always says the same as conky, so I 
guess it does update correctly).

The Story And What Happens (to indirectly quote Terry Pratchett):
Whenever I run Emacs 26.1 (Lucid X interface) and it loads its package 
configuration, it quickly allocates about 300 to 400 MB of RAM, and when 
I use several Emacs modi (org, auctex, etc), it tends to allocate about 
700 MB in total.  Accumulated on top of my average system load, the used 
memory rapidly goes from 520MB to 1.2 GB just due to Emacs.  When I quit 
Emacs, the used RAM does only drop back to about 1.1 to 1.0 GB, not to, 
say, 600MB as I would expect (and as Emacs 23 and 25 do – well, Emacs 25 
doesn't release all memory, either, but leaves only an after-print of, 
say, 30 MB, not 400).  And even several hours later with nothing running 
except for the wm (fvwm, if you want to know), conky and a screen saver 
the memory is not released, so I presume it is not caused by the 
caching/preemptivity mechanisms of the system kernel or the library loader.

Is this behaviour perhaps due to Emacs's code being aligned to modern C 
compilers, libraries, and bloated system configurations?  Perhaps, even, 
due to yours concentrating on GTK3 as X UI?  I am asking this because I 
run a debian 6 system, with GCC 4.x, GTK2 (which I do not use, if 
possible), without servicesd or systemd and with somewhat older memory 
management libraries.

Can this be resolved on your side, or is there a trick I can use, except 
for re-starting my whole system?

Regards,
R.Kuligowski