Subject: Re: bug#40194: Weak sets keep growing

From: Ludovic Courtès <[email-masked]>
Date: Mon, 23 Mar 2020 22:57:33 +0100

Ludovic Courtès <[email-masked]> skribis:

> The size of the weak set keeps growing, even when GC happens.

Commit 02e3dc6ab95fe51786b68a8200322e163f8da478 mostly addresses it:

--8<---------------cut here---------------start------------->8---
$ ./meta/guile -s ~/src/guile-debugging/weak-set-growth.scm

;;; (10 #<weak-set 3517/7027>)

;;; (9 #<weak-set 10271/14051>)

;;; (8 #<weak-set 11711/14051>)

;;; (7 #<weak-set 9895/14051>)

;;; (6 #<weak-set 7697/14051>)

;;; (5 #<weak-set 11559/14051>)

;;; (4 #<weak-set 9220/14051>)

;;; (3 #<weak-set 6833/14051>)

;;; (2 #<weak-set 10637/14051>)

;;; (1 #<weak-set 8232/14051>)
--8<---------------cut here---------------end--------------->8---

It turns out that the core issue is that ‘vacuum_all_weak_sets’ is only
ever called a couple of times at the beginning of the execution, and
that’s it.

So it seems that the trick of ‘scm_i_register_async_gc_callback’ no
longer works as expected.

Thoughts?

Incidentally, in the reproducer I posted, if you insert (gc) after
(create-symbols), then the weak set grows a bit more!  Which makes me
wonder if we’re not leaking entries due to messed up disappearing links
or something.

Ludo’.