GNU bug report logs - #28590
Weak tables in 2.2.2 grow indefinitely

Previous Next

Package: guile;

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

Date: Mon, 25 Sep 2017 08:50:01 UTC

Severity: serious

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: tracker <at> debbugs.gnu.org, bug-strong-list <at> debbugs.gnu.org
Subject: bug#28590: closed (Weak tables in 2.2.2 grow indefinitely)
Date: Tue, 07 Nov 2017 11:00:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 07 Nov 2017 11:58:58 +0100
with message-id <874lq69wy5.fsf <at> gnu.org>
and subject line Re: bug#28590: Weak tables in 2.2.2 grow indefinitely
has caused the debbugs.gnu.org bug report #28590,
regarding Weak tables in 2.2.2 grow indefinitely
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
28590: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28590
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-guile <at> gnu.org
Subject: Weak tables in 2.2.2 grow indefinitely
Date: Mon, 25 Sep 2017 10:49:13 +0200
Consider this program:

--8<---------------cut here---------------start------------->8---
(use-modules (ice-9 format))

(define loops 3000000)

(define table
  (make-weak-key-hash-table))

(let loop ((i loops))
  (unless #f ;(zero? i)
    (when (zero? (modulo i 100000))
      (format #t "heap-size: ~,2h MiB  table: ~s~%"
              (/ (assoc-ref (gc-stats) 'heap-size) (expt 2. 20))
              table))

    (hashq-set! table (cons 1 2) #t)
    (loop (1- i))))
--8<---------------cut here---------------end--------------->8---

On 2.0.14, the heap size stays at around 24 MiB, and the table size is
stable at 224,717 buckets (?).

On 2.2.2, the heap grows indefinitely (though logarithmically).  It’s
not deterministic though: sometimes the heap size stabilizes in the
140–300 MiB range, and sometimes it keeps growing endlessly even though
the table size reaches a maxium at 7,190,537 entries.

Ludo’.


[Message part 3 (message/rfc822, inline)]
From: ludo <at> gnu.org (Ludovic Courtès)
To: 28590-done <at> debbugs.gnu.org
Subject: Re: bug#28590: Weak tables in 2.2.2 grow indefinitely
Date: Tue, 07 Nov 2017 11:58:58 +0100
ludo <at> gnu.org (Ludovic Courtès) skribis:

> Consider this program:
>
> (use-modules (ice-9 format))
>
> (define loops 3000000)
>
> (define table
>   (make-weak-key-hash-table))
>
> (let loop ((i loops))
>   (unless #f ;(zero? i)
>     (when (zero? (modulo i 100000))
>       (format #t "heap-size: ~,2h MiB  table: ~s~%"
>               (/ (assoc-ref (gc-stats) 'heap-size) (expt 2. 20))
>               table))
>
>     (hashq-set! table (cons 1 2) #t)
>     (loop (1- i))))
>
> On 2.0.14, the heap size stays at around 24 MiB, and the table size is
> stable at 224,717 buckets (?).
>
> On 2.2.2, the heap grows indefinitely (though logarithmically).  It’s
> not deterministic though: sometimes the heap size stabilizes in the
> 140–300 MiB range, and sometimes it keeps growing endlessly even though
> the table size reaches a maxium at 7,190,537 entries.

This is fixed with Andy’s rewrite of weak tables to bucket-and-chains as
in 2.0:

  https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=a053c0510c4a644f9453166b7b385cf30f6d3a21
  https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=d01addeb1feba830ddd703e27f89576864a063ff
  https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=dc8dda77e0c937abae42a76ea88c6e7995adbd9a
  https://lists.gnu.org/archive/html/guile-devel/2017-10/msg00051.html

\o/

Ludo’.


This bug report was last modified 7 years and 202 days ago.

Previous Next


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