1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-16 10:50:49 -08:00

Use after-load-functions to GC after loading each file.

Remove the explicit GC calls that used to be sprinkled around.
This commit is contained in:
Stefan Monnier 2009-09-15 03:46:05 +00:00
parent 428b13d63c
commit 0e328d3779
2 changed files with 11 additions and 15 deletions

View file

@ -1,5 +1,8 @@
2009-09-15 Stefan Monnier <monnier@iro.umontreal.ca> 2009-09-15 Stefan Monnier <monnier@iro.umontreal.ca>
* loadup.el: Use after-load-functions to GC after loading each file.
Remove the explicit GC calls that used to be sprinkled around.
* subr.el (after-load-functions): New hook. * subr.el (after-load-functions): New hook.
(do-after-load-evaluation): Run it. Use string-match-p to detect (do-after-load-evaluation): Run it. Use string-match-p to detect
`obsolete' packages, rather than painfully extracting the relevant `obsolete' packages, rather than painfully extracting the relevant

View file

@ -60,6 +60,10 @@
(load "emacs-lisp/backquote") (load "emacs-lisp/backquote")
(load "subr") (load "subr")
;; Do it after subr, since both after-load-functions and add-hook are
;; implemented in subr.el.
(add-hook 'after-load-functions '(lambda (f) (garbage-collect)))
;; We specify .el in case someone compiled version.el by mistake. ;; We specify .el in case someone compiled version.el by mistake.
(load "version.el") (load "version.el")
@ -82,17 +86,12 @@
(load "button") (load "button")
(load "startup") (load "startup")
(message "Lists of integers (garbage collection statistics) are normal output")
(message "while building Emacs; they do not indicate a problem.")
(message "%s" (garbage-collect))
(condition-case nil (condition-case nil
;; Don't get confused if someone compiled this by mistake. ;; Don't get confused if someone compiled this by mistake.
(load "loaddefs.el") (load "loaddefs.el")
;; In case loaddefs hasn't been generated yet. ;; In case loaddefs hasn't been generated yet.
(file-error (load "ldefs-boot.el"))) (file-error (load "ldefs-boot.el")))
(message "%s" (garbage-collect))
(load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table. (load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table.
(load "simple") (load "simple")
@ -159,7 +158,6 @@
(load "isearch") (load "isearch")
(load "rfn-eshadow") (load "rfn-eshadow")
(message "%s" (garbage-collect))
(load "menu-bar") (load "menu-bar")
(load "paths.el") ;Don't get confused if someone compiled paths by mistake. (load "paths.el") ;Don't get confused if someone compiled paths by mistake.
(load "emacs-lisp/lisp") (load "emacs-lisp/lisp")
@ -169,7 +167,6 @@
(load "emacs-lisp/lisp-mode") (load "emacs-lisp/lisp-mode")
(load "textmodes/text-mode") (load "textmodes/text-mode")
(load "textmodes/fill") (load "textmodes/fill")
(message "%s" (garbage-collect))
(load "replace") (load "replace")
(load "buff-menu") (load "buff-menu")
@ -187,8 +184,6 @@
(load "term/common-win") (load "term/common-win")
(load "term/x-win"))) (load "term/x-win")))
(message "%s" (garbage-collect))
(if (eq system-type 'windows-nt) (if (eq system-type 'windows-nt)
(progn (progn
(load "w32-vars") (load "w32-vars")
@ -219,22 +214,18 @@
(if (fboundp 'atan) ; preload some constants and (if (fboundp 'atan) ; preload some constants and
(progn ; floating pt. functions if we have float support. (progn ; floating pt. functions if we have float support.
(load "emacs-lisp/float-sup"))) (load "emacs-lisp/float-sup")))
(message "%s" (garbage-collect))
(load "vc-hooks") (load "vc-hooks")
(load "ediff-hook") (load "ediff-hook")
(if (fboundp 'x-show-tip) (load "tooltip")) (if (fboundp 'x-show-tip) (load "tooltip"))
(message "%s" (garbage-collect))
;If you want additional libraries to be preloaded and their ;If you want additional libraries to be preloaded and their
;doc strings kept in the DOC file rather than in core, ;doc strings kept in the DOC file rather than in core,
;you may load them with a "site-load.el" file. ;you may load them with a "site-load.el" file.
;But you must also cause them to be scanned when the DOC file ;But you must also cause them to be scanned when the DOC file
;is generated. ;is generated.
;For other systems, you must edit ../src/Makefile.in. ;For other systems, you must edit ../src/Makefile.in.
(if (load "site-load" t) (load "site-load" t)
(garbage-collect))
;; Determine which last version number to use ;; Determine which last version number to use
;; based on the executables that now exist. ;; based on the executables that now exist.
@ -327,11 +318,13 @@
(equal (nth 4 command-line-args) "bootstrap")) (equal (nth 4 command-line-args) "bootstrap"))
(setcdr load-path nil)) (setcdr load-path nil))
(remove-hook 'after-load-functions '(lambda (f) (garbage-collect)))
(setq inhibit-load-charset-map nil) (setq inhibit-load-charset-map nil)
(clear-charset-maps) (clear-charset-maps)
(garbage-collect) (garbage-collect)
;;; At this point, we're ready to resume undo recording for scratch. ;; At this point, we're ready to resume undo recording for scratch.
(buffer-enable-undo "*scratch*") (buffer-enable-undo "*scratch*")
(if (null (garbage-collect)) (if (null (garbage-collect))