bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19180: Weak tables harmful to GC?


From: Ludovic Courtès
Subject: bug#19180: Weak tables harmful to GC?
Date: Thu, 26 Oct 2017 22:28:37 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi,

Ricardo Wurmus <address@hidden> skribis:

>   BOOTSTRAP GUILEC language/tree-il/primitives.go
> /gnu/store/kpxi8h3669afr9r1bgvaf9ij3y4wdyyn-bash-minimal-4.4.12/bin/bash: 
> line 6: 30173 Killed                  GUILE_AUTO_COMPILE=0 ../meta/build-env 
> guild compile --target="x86_64-unknown-linux-gnu" -O1 -L 
> "/tmp/guix-build-guile-awesome-2.2.2.drv-0/guile-2.2.2/module" -L 
> "/tmp/guix-build-guile-awesome-2.2.2.drv-0/guile-2.2.2/guile-readline" -o 
> "ice-9/vlist

Funny: with the “cleanup” that led to the patches you tried, those weak
hash tables were not weak at all, because SCM_WEAK_TABLE_KIND_KEY was
now zero, and thus SCM_HASHTABLE_WEAK_P would always return false.  The
fix:

diff --git a/libguile/hashtab.h b/libguile/hashtab.h
index 8f422b0b5..1705cf744 100644
--- a/libguile/hashtab.h
+++ b/libguile/hashtab.h
@@ -33,6 +33,7 @@
 
 /* Types of weak hash tables.  */
 typedef enum {
+  SCM_WEAK_TABLE_KIND_NONE = 0,
   SCM_WEAK_TABLE_KIND_KEY,
   SCM_WEAK_TABLE_KIND_VALUE,
   SCM_WEAK_TABLE_KIND_BOTH
@@ -51,7 +52,9 @@ typedef enum {
 #define SCM_HASHTABLE_DOUBLY_WEAK_P(x) \
   (SCM_HASHTABLE_FLAGS (x) == SCM_WEAK_TABLE_KIND_BOTH)
 
-#define SCM_HASHTABLE_WEAK_P(x)           SCM_HASHTABLE_FLAGS (x)
+#define SCM_HASHTABLE_WEAK_P(x)                                \
+  (SCM_HASHTABLE_FLAGS (x) != SCM_WEAK_TABLE_KIND_NONE)
+
 #define SCM_HASHTABLE_N_ITEMS(x)   (SCM_HASHTABLE (x)->n_items)
 #define SCM_SET_HASHTABLE_N_ITEMS(x, n)   (SCM_HASHTABLE (x)->n_items = n)
 #define SCM_HASHTABLE_INCREMENT(x) (SCM_HASHTABLE_N_ITEMS(x)++)
(Updated patches below.)

With your package definition, I see the first few Guile processes peak
at ~100 MiB resident (would be interesting to compare with stock 2.2.2).

Let me know if it’s better this time!

Thanks again for testing,
Ludo’.

Attachment: 0001-Remove-weak-tables-and-revert-to-weak-hash-tables.patch
Description: Text Data

Attachment: 0002-Keep-weak-hash-table-item-count-consistent.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]