GNU bug report logs -
#45200
Wishlist: There should be a `malloc-trim' function
Previous Next
Reported by: Konstantin Kharlamov <hi-angel <at> yandex.ru>
Date: Sat, 12 Dec 2020 18:44:02 UTC
Severity: wishlist
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The problem is basically: (garbage-collect) refuses to collect some of the memory. It is more visible if you delay garbage collection, which is what I do for for performance-related reasons. My config has the following snippet:
;; only run garbage collection on idle
(setq gc-cons-threshold most-positive-fixnum)
(run-with-idle-timer 2 t (lambda () (garbage-collect)))
How much memory gets lost depends on configuration. For me right after start the difference is 40 MB: ≈60 MB is Emacs PSS size without above code, and ≈100 MB it is when garbage-collection is delayed, *after* I run explicitly (garbage-collect). It is less visible without any other configs, nonetheless it's visible.
# Steps to reproduce:
1. Run `mkdir /tmp/.emacs.d`
2. Run emacs as `HOME=/tmp/ emacs`, and measure its PSS
3. Create a file /tmp/.emacs.d/early-init.el with content:
;; only run garbage collection on idle
(setq gc-cons-threshold most-positive-fixnum)
(run-with-idle-timer 2 t (lambda () (garbage-collect)))
4. Run emacs as `HOME=/tmp/ emacs`, evaluate (garbage-collect), then measure its PSS
## Expected
Size has no statistically-significant difference, because in both cases we garbage-collected memory.
## Actual
Size without calling explicit garbage-collect, from 3 runs, varied around 41.2..41.7 MB.
Size afterwards, also 3 runs, varied around 45.4..45.5 MB.
This is 4 MB lost. While not much, but as I mentioned it grows as much as to 40MB. The Emacs whose emacslient I'm using to write this email has size 218 MB, and now I wouldn't be surprised if much of that is actually a leaked memory.
# Version
Emacs-git 28.0.50, build from commit abd15e088e99
This bug report was last modified 3 years and 78 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.