mit-scheme-devel
[Top][All Lists]
Advanced

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

Re: [MIT-Scheme-devel] Cleaning weak hash tables in secondary GC daemon?


From: Alexey Radul
Subject: Re: [MIT-Scheme-devel] Cleaning weak hash tables in secondary GC daemon?
Date: Wed, 14 Sep 2011 20:21:48 +0100

On Wed, Sep 14, 2011 at 7:42 PM, Taylor R Campbell <address@hidden> wrote:
>   Date: Wed, 14 Sep 2011 19:17:09 +0100
>   From: Alexey Radul <address@hidden>
>
>   Is there any reason why there is no secondary GC daemon that runs
>   hash-table/clean! on all weak hash tables?  Are there any issues I
>   should be aware of before installing one to clean some select weak
>   hash tables that are present in my program?
>
> It's not a good idea to call HASH-TABLE/CLEAN! in a GC daemon because
> it may rehash the table in case it has shrunk.  But just cleaning the
> table and not shrinking & rehashing it may leave it in a bogus state.
> Working around this probably requires implementing a deferred-rehash
> mechanism.  Not conceptually difficult, but it would take a bit of
> work.

Stupid question: why would rehashing the table be bad?
>From the comments in runtime/gcdemn.scm:

  ;;; SECONDARY-GC-DAEMONS are executed rarely.  Their purpose is to
  ;;; reclaim storage that is either unlikely to be reclaimed or
  ;;; expensive to reclaim.

Sounds like a very good description of the storage-reclamation value
of cleaning a weak hash table.  Speaking of which, when are secondary
GC daemons run?

Thanks,
~Alexey



reply via email to

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