GNU bug report logs - #40194
Weak sets keep growing

Previous Next

Package: guile;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Mon, 23 Mar 2020 14:18:01 UTC

Severity: important

To reply to this bug, email your comments to 40194 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#40194; Package guile. (Mon, 23 Mar 2020 14:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 23 Mar 2020 14:18:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-Guile <at> gnu.org
Subject: Weak sets keep growing
Date: Mon, 23 Mar 2020 15:17:46 +0100
Hello,

Consider this code:

--8<---------------cut here---------------start------------->8---
(define (create-symbols)
  (let loop ((i 10000))
    (unless (zero? i)
      (gensym)
      (loop (1- i)))))

(let loop ((i 10))
  (unless (zero? i)
    (pk i (%symbols))
    (create-symbols)
    (loop (1- i))))
--8<---------------cut here---------------end--------------->8---

(You need to have the ‘%symbols’ procedure from libguile/symbols.c
compiled in.)

In 3.0.1+, it prints:

--8<---------------cut here---------------start------------->8---
;;; (10 #<weak-set 3517/7027>)

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

;;; (8 #<weak-set 11625/28099>)

;;; (7 #<weak-set 21625/28099>)

;;; (6 #<weak-set 11090/56197>)

;;; (5 #<weak-set 21090/56197>)

;;; (4 #<weak-set 31090/56197>)

;;; (3 #<weak-set 41090/56197>)

;;; (2 #<weak-set 5052/112363>)

;;; (1 #<weak-set 15052/112363>)
--8<---------------cut here---------------end--------------->8---

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

Conversely, weak tables shrink upon GC.

Ludo’.




Information forwarded to bug-guile <at> gnu.org:
bug#40194; Package guile. (Mon, 23 Mar 2020 21:58:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: 40194 <at> debbugs.gnu.org
Subject: Re: bug#40194: Weak sets keep growing
Date: Mon, 23 Mar 2020 22:57:33 +0100
Ludovic Courtès <ludo <at> gnu.org> 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’.




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 26 Apr 2020 17:15:02 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 12 days ago.

Previous Next


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