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

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-Guile <at> gnu.org
Subject: bug#40194: 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’.




This bug report was last modified 5 years and 50 days ago.

Previous Next


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