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

Hash Tables and GC



re: Just to throw a little light into this discussion:   On Symbolics systems 
    there is a list of forms to be evaluated before any gc flip (ephemeral or 
    dynamic).  It's possible to implement whatever kind of weak pointers 
    strategy you want by explicitly clearing whatever pointers are "weak" 
    before the flip occurs.  The list is called SI:GC-EVERY-FLIP-LIST

Hmmmmm.   As barmar points out, this could't work _in general_  for weak
pointers unless you also restore the non-GC'd entries that you deleted.


PDP10 MacLisp provided a different variant of this -- the infamous GC
hook [sigh, there were so many "hooks" in MacLisp!].  Just _after_ a GC
finishs, but before any more consing is done, the user's "hook" function 
is run.  At this unique interval in time, it is possible to ask of a random 
address/pointer "Were you just GC'd"; [in fact, this capability is independent 
of whether it is a copying, or collecting or refcnt'ing GC].  Then using NIL 
type arrays, pointers could be kept around for inspection after the GC; the 
"NIL type" array simply means that the GC doesn't mark or descend the entries 
(just like XPOINTER type arrays in Interlisp-D].

GJS used this hook to good advantage in MicroPlanner and early Scheme
implementations.  In effect, I think he implemnted :temporary type
hash tables.

-- JonL --