GNU bug report logs -
#79021
31.0.50; Unnecessary GC in after-load-functions
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Tue, Jul 15 2025, Stefan Monnier wrote:
>>> In loadup.el there is this:
>>>
>>> (add-hook 'after-load-functions (lambda (_) (garbage-collect)))
>>>
>>> What's this for? It seems unnecessary.
>>>
>>> It would be nice to remove this, because without it the time to execute
>>> loadup.el goes down from 13 seconds to 6.
>>
>> I presume this is because we don't want to dump any garbage.
>> Stefan?
>
> AFAIK it was added to keep the dumped Emacs' heap "dense": if we run the
> GC only "in the normal way", the heap objects created during `loadup.el`
> end up interspersed with more free spaces.
>
> It's possible/likely that the portable dumper has made that unnecessary.
Should I commit this?
[loadup.patch (text/x-diff, inline)]
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 18f09878f98..05bd468b713 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -127,7 +127,11 @@
;; Do it after subr, since both after-load-functions and add-hook are
;; implemented in subr.el.
-(add-hook 'after-load-functions (lambda (_) (garbage-collect)))
+;;
+;; This was probably done to reduce fragmentation with unexec. With the
+;; pdumper it makes little sense. See bug#79021.
+(if (not (fboundp 'dump-emacs-portable))
+ (add-hook 'after-load-functions (lambda (_) (garbage-collect))))
(load "version")
This bug report was last modified 7 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.