From 7f5a834fdb5f8c61eea21c66db2036c81fdfa302 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 19 Jan 2015 11:14:04 -0700 Subject: [PATCH] allow weak hash tables to shrink --- racket/src/racket/src/hash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/racket/src/racket/src/hash.c b/racket/src/racket/src/hash.c index 7436a7a3ff..2001aee756 100644 --- a/racket/src/racket/src/hash.c +++ b/racket/src/racket/src/hash.c @@ -795,6 +795,10 @@ get_bucket (Scheme_Bucket_Table *table, const char *key, int add, Scheme_Bucket if (actual * FILL_FACTOR < table->count) { /* Decrement size so that the table won't actually grow. */ table->size >>= 1; + if ((table->size > 64) && (2 * actual * FILL_FACTOR < table->count)) { + /* Allow the table to shrink */ + table->size >>= 1; + } } }