]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/alloc.c (garbage_collect): Run `post-gc-hook` later (bug#65700)
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 12 Sep 2023 18:06:54 +0000 (14:06 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 12 Sep 2023 18:06:54 +0000 (14:06 -0400)
etc/NEWS
src/alloc.c

index 29d44a622cb7002ee976ad222b533bd29209efda..c146f464585690d73cdc2eb87c4bd33e9aeeab7e 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -831,6 +831,8 @@ the file listing's performance is still optimized.
 \f
 * Incompatible Lisp Changes in Emacs 30.1
 
+** 'post-gc-hook' runs after updating 'gcs-done' and `'gcs-elapsed'.
+
 ---
 ** The escape sequence '\x' not followed by hex digits is now an error.
 Previously, '\x' without at least one hex digit denoted character code
index c0086a70fc1b6f9bbe766a04ee44cf6176b461b4..fbb1c6ed6c39b31c56e0e5ddba112f9f6172a9ea 100644 (file)
@@ -6595,13 +6595,6 @@ garbage_collect (void)
   image_prune_animation_caches (false);
 #endif
 
-  if (!NILP (Vpost_gc_hook))
-    {
-      specpdl_ref gc_count = inhibit_garbage_collection ();
-      safe_run_hooks (Qpost_gc_hook);
-      unbind_to (gc_count, Qnil);
-    }
-
   /* Accumulate statistics.  */
   if (FLOATP (Vgc_elapsed))
     {
@@ -6620,6 +6613,13 @@ garbage_collect (void)
       if (tot_after < tot_before)
        malloc_probe (min (tot_before - tot_after, SIZE_MAX));
     }
+
+  if (!NILP (Vpost_gc_hook))
+    {
+      specpdl_ref gc_count = inhibit_garbage_collection ();
+      safe_run_hooks (Qpost_gc_hook);
+      unbind_to (gc_count, Qnil);
+    }
 }
 
 DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",