unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: 28590-done@debbugs.gnu.org
Subject: bug#28590: Weak tables in 2.2.2 grow indefinitely
Date: Tue, 07 Nov 2017 11:58:58 +0100	[thread overview]
Message-ID: <874lq69wy5.fsf@gnu.org> (raw)
In-Reply-To: <87poafkvsm.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 25 Sep 2017 10:49:13 +0200")

ludo@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’.





      parent reply	other threads:[~2017-11-07 10:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25  8:49 bug#28590: Weak tables in 2.2.2 grow indefinitely Ludovic Courtès
2017-09-26  9:57 ` Ludovic Courtès
2017-10-02  9:53 ` Ludovic Courtès
2017-10-03 11:43 ` bug#28590: [PATCH 0/7] Attempt to reduce memory growth Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 1/7] weak-table: Fix unbounded growth of the disappearing link table Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 2/7] weak-table: Stress the GC a little less when resizing Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 3/7] weak-table: Make sure 'move_disappearing_links' actually moves links Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 4/7] weak-table: Always unregister previous links when inserting an entry Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 5/7] weak-table: 'move_weak_entry' reports disappeared links Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 6/7] weak-table: 'rob_from_rich' accounts for disappeared entries Ludovic Courtès
2017-10-03 11:43   ` bug#28590: [PATCH 7/7] weak-table: Resize less frequently Ludovic Courtès
2017-10-04 13:09   ` bug#28590: [PATCH 0/7] Attempt to reduce memory growth Ludovic Courtès
2017-10-05 14:09     ` Ludovic Courtès
2017-11-07 10:58 ` Ludovic Courtès [this message]

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=874lq69wy5.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=28590-done@debbugs.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).