[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hash tables and GC
- To: sandra@cs.utah.edu (Sandra J Loosemore)
- Subject: Re: hash tables and GC
- From: Rob.MacLachlan@WB1.CS.CMU.EDU
- Date: Thu, 01 Sep 88 15:07:46 EDT
- Cc: common-lisp@sail.stanford.edu
- In-reply-to: Your message of Thu, 01 Sep 88 09:29:10 -0600. <8809011529.AA00519@cs.utah.edu>
There is also the rather similar "weak pointer" notion, which I believe is
implemented in T. The operations on a weak pointer are something like:
MAKE-WEAK-POINTER Object => Weak-Pointer
INDIRECT-WEAK-POINTER Weak-Pointer => Object or NIL
Having a weak pointer to an object allows you to keep track of it, but
doesn't prevent GC. Although I haven't ever used either weak pointers or
GC'able hash-tables, I think weak pointers are superior as a language
feature, since they are more primitive and potentially more efficient.
The GC-able hash-table notion unnecessarily complicates the semantics by
rolling in hash-table semantics when the real issue is with GC. Usually
the association capacity of hashtables is unnecessary: instead of
weak-hashing from A to B, allocate another slot in A to hold the weak
pointer to B.
The implementation issues are basically the same as for GC-able
hash-tables, but weak pointers seem to have a sight edge. They can be
implemented by allocating weak pointers in a special area, but given
abundant tag bits, immediate representations are also conceivable.
Rob