aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2023-09-12 14:06:54 -0400
committerStefan Monnier2023-09-12 14:06:54 -0400
commit1e1f3e30efd650af9d995575ce23c585aaeb6e78 (patch)
treeb52f53f7e32b69b959edd2bad0c7bc4a0d48e67f
parentff87aecf8554042b043467a7aaff1a758df0bbae (diff)
downloademacs-1e1f3e30efd650af9d995575ce23c585aaeb6e78.tar.gz
emacs-1e1f3e30efd650af9d995575ce23c585aaeb6e78.zip
* src/alloc.c (garbage_collect): Run `post-gc-hook` later (bug#65700)
-rw-r--r--etc/NEWS2
-rw-r--r--src/alloc.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 29d44a622cb..c146f464585 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -831,6 +831,8 @@ the file listing's performance is still optimized.
831 831
832* Incompatible Lisp Changes in Emacs 30.1 832* Incompatible Lisp Changes in Emacs 30.1
833 833
834** 'post-gc-hook' runs after updating 'gcs-done' and `'gcs-elapsed'.
835
834--- 836---
835** The escape sequence '\x' not followed by hex digits is now an error. 837** The escape sequence '\x' not followed by hex digits is now an error.
836Previously, '\x' without at least one hex digit denoted character code 838Previously, '\x' without at least one hex digit denoted character code
diff --git a/src/alloc.c b/src/alloc.c
index c0086a70fc1..fbb1c6ed6c3 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6595,13 +6595,6 @@ garbage_collect (void)
6595 image_prune_animation_caches (false); 6595 image_prune_animation_caches (false);
6596#endif 6596#endif
6597 6597
6598 if (!NILP (Vpost_gc_hook))
6599 {
6600 specpdl_ref gc_count = inhibit_garbage_collection ();
6601 safe_run_hooks (Qpost_gc_hook);
6602 unbind_to (gc_count, Qnil);
6603 }
6604
6605 /* Accumulate statistics. */ 6598 /* Accumulate statistics. */
6606 if (FLOATP (Vgc_elapsed)) 6599 if (FLOATP (Vgc_elapsed))
6607 { 6600 {
@@ -6620,6 +6613,13 @@ garbage_collect (void)
6620 if (tot_after < tot_before) 6613 if (tot_after < tot_before)
6621 malloc_probe (min (tot_before - tot_after, SIZE_MAX)); 6614 malloc_probe (min (tot_before - tot_after, SIZE_MAX));
6622 } 6615 }
6616
6617 if (!NILP (Vpost_gc_hook))
6618 {
6619 specpdl_ref gc_count = inhibit_garbage_collection ();
6620 safe_run_hooks (Qpost_gc_hook);
6621 unbind_to (gc_count, Qnil);
6622 }
6623} 6623}
6624 6624
6625DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", 6625DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",