GNU bug report logs -
#78917
feature/igc [PATCH] Avoid chaining finalizers together
Previous Next
Full log
Message #32 received at submit <at> debbugs.gnu.org (full text, mbox):
Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:
> "Helmut Eller" <eller.helmut <at> gmail.com> writes:
>
>> On Sat, Jun 28 2025, Pip Cet wrote:
>>
>>> "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.
>>>
>>> See https://lists.gnu.org/archive/html/emacs-devel/2025-05/msg00468.html
>>
>> :-)
>>
>>> and bug#77338.
>>
>> It seems that the problem with finalizers as value in a weak hashtable
>> could be fixed by calling mark_and_sweep_weak_table_contents before
>> queue_doomed_finalizers as in the patch below.
Ouch. That branch of the discussion of bug#77338 slipped past me.
Thanks for bringing it up.
Gut feeling is that the solution is some kind of iterated walk over
finalizers and weak tables until we reach a fixed point? Let me think
it over.
>
> No, that's not the right fix: a finalizer function can still refer to
> weak hash tables (the finalizer itself is not a weak object), so we
> can't sweep the weak hash tables until all finalizers have been marked.
>
> This is solvable, but it requires more effort than exchanging those two
> calls.
>
> However, I'm not sure we should fix the traditional GC code to be better
> than what MPS can do :-)
Emacs 31 is going to live a long time and igc won't be its default GC.
This bug report was last modified 31 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.