On Wed, Sep 14, 2011 at 7:42 PM, Taylor R Campbell <[email protected]> wrote: > Date: Wed, 14 Sep 2011 19:17:09 +0100 > From: Alexey Radul <[email protected]> > > 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 _______________________________________________ MIT-Scheme-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/mit-scheme-devel
