[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MIT-Scheme-devel] weak hash table data
From: |
Chris Hanson |
Subject: |
Re: [MIT-Scheme-devel] weak hash table data |
Date: |
Tue, 22 Dec 2009 02:04:03 -0800 |
This is incorrect. GC marks every table as needing rehash; the next
access to that table forces a rehash, which cleans the table.
On Mon, Dec 21, 2009 at 10:09 PM, Taylor R Campbell <address@hidden> wrote:
> Key-weak hash tables are never cleaned automatically, not even in a
> secondary GC daemon; unless you call HASH-TABLE/CLEAN! or cause them
> to be rehashed, broken entries will retain their data (but not their
> keys) strongly.
>
> (let ((a (make-eq-hash-table))
> (b (make-eq-hash-table)))
> (let ((p (list 'p))
> (q (list 'q))
> (r (list 'r)))
> (hash-table/put! a p q)
> (hash-table/put! b q r))
> (gc-flip)
> (list (hash-table/datum-list a)
> (hash-table/datum-list b)))
> ;Value: (() ((r)))
>
> The manual doesn't claim that *associations* are deleted from weak
> hash tables if their keys are reclaimed -- it says only that the hash
> table holds its keys weakly --, but this is not the behaviour I expect
> for an object called a `weak hash table'. Does this behaviour worry
> anyone else?
>
>
> _______________________________________________
> MIT-Scheme-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/mit-scheme-devel
>