GNU bug report logs - #78917
feature/igc [PATCH] Avoid chaining finalizers together

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Sat, 28 Jun 2025 04:44:01 UTC

Severity: normal

Tags: patch

Full log


Message #14 received at 78917 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 78917 <at> debbugs.gnu.org
Subject: Re: bug#78917: feature/igc [PATCH] Avoid chaining finalizers together
Date: Sat, 28 Jun 2025 09:14:12 +0000
"Helmut Eller" <eller.helmut <at> gmail.com> writes:

> Lisp_Finalizers are currently chained together in a doubly linked list.
> This prevents them from being collected.  I propose that we simply don't
> use this list with MPS.
>
> The first patch is minimalistic: it only skips finalizer_insert when
> creating finalizers.
>
> The second patch is more thorough: it #ifdefs away the prev/next fields
> entirely.

Looks good, except for the addition of igc--process-messages;
igc--collect should process *all* messages before returning, and
exposing a function that processes only some of the messages doesn't
seem useful to me.

The test probably should be rewritten to something like this:

;; Ensure finalizers are collected and bug#78917 doesn't reappear.
(ert-deftest test-two-finalizers ()
  ;; this test will usually succeed, but might fail due to unpredictable
  ;; references to the finalizer on the C stack or elsewhere.
  :tags '(:igc :unstable)
  (let* ((garbage-collection-messages t)
         (finalizer-1-called nil)
         (finalizer-2-called nil)
         (finalizer-1 (make-finalizer (lambda (setq finalizer-1-called t))))
         (finalizer-2 (make-finalizer (lambda (setq finalizer-2-called t)))))
    (dotimes (_ 3)
      (igc--collect)
      (sleep-for 0.1))
    (should (not finalizer-1-called))
    (should (not finalizer-2-called))
    (setq finalizer-1 nil)
    (dotimes (_ 1)
      (igc--collect)
      (accept-process-output nil 1 0 t))
    (should finalizer-1-called)
    (should (not finalizer-2-called))))

Pip





This bug report was last modified 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.