From: "Ludovic Courtès" <ludo@gnu.org>
To: bug-Guile@gnu.org
Subject: bug#40194: Weak sets keep growing
Date: Mon, 23 Mar 2020 15:17:46 +0100 [thread overview]
Message-ID: <87h7yfqho5.fsf@gnu.org> (raw)
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’.
next reply other threads:[~2020-03-23 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 14:17 Ludovic Courtès [this message]
2020-03-23 21:57 ` bug#40194: Weak sets keep growing Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7yfqho5.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=bug-Guile@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).