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: Ludovic Courtès <ludo <at> gnu.org>
To: wingo <at> igalia.com
Cc: Ludovic Courtès <ludo <at> gnu.org>, 28590 <at> debbugs.gnu.org
Subject: bug#28590: [PATCH 6/7] weak-table: 'rob_from_rich' accounts for disappeared entries.
Date: Tue,  3 Oct 2017 13:43:51 +0200
* libguile/weak-table.c (rob_from_rich): Leave the loop also if 'key' or
'value' is zero.  Reset 'hash'.
---
 libguile/weak-table.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libguile/weak-table.c b/libguile/weak-table.c
index 5c4b3d30a..24fff4e73 100644
--- a/libguile/weak-table.c
+++ b/libguile/weak-table.c
@@ -292,7 +292,11 @@ rob_from_rich (scm_t_weak_table *table, unsigned long k)
   empty = k;
   do 
     empty = (empty + 1) % size;
-  while (table->entries[empty].hash);
+  while (table->entries[empty].hash
+	 && table->entries[empty].key
+	 && table->entries[empty].value);
+
+  table->entries[empty].hash = 0;
 
   do
     {
-- 
2.14.2





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.