From 2f8b49ea7a868760c9154960bca8cf4908398526 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 6 Dec 2024 23:15:48 -0500 Subject: [PATCH] fix: reset gc-cons-threshold if not already --- lisp/doom.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/doom.el b/lisp/doom.el index c1564aa3c..38a5bed30 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -899,6 +899,13 @@ Triggers `doom-after-init-hook' and sets `doom-init-time.'" (when (doom-context-pop 'startup) (setq doom-init-time (float-time (time-subtract (current-time) before-init-time))) (doom-run-hooks 'doom-after-init-hook) + + ;; If `gc-cons-threshold' hasn't been reset at this point, we reset it by + ;; force (without overwriting `gcmh' or the user's config). If this isn't + ;; done, this session will be prone to freezing and crashes. This also + ;; handles the case where the user has `gcmh' disabled. + (when (eq (default-value 'gc-cons-threshold) most-positive-fixnum) + (setq-default gc-cons-threshold (* 16 1024 1024))) t)) (provide 'doom)