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

Re: Restoring objects



>bill@cambridge.apple.com (Bill St. Clair) writes:
>
>> 
>> The only drawback with this is that no instance of cleanup-mixin
>> will be gc'able. You can solve this by using weak hash tables
>> (undocumented, but present in both 2.0b1 and 2.0 final).
>
>What are "weak hash tables", how do they work, and what are they good
>for?

A weak hash table is one whose elements will be GCed if they are no longer
visible anywhere else.  ie, the hash-table doesn't "count" as far as GC is
concerned.

How they work depends on the GC algorithm, of course, but basically the
process the algorithm uses to count/determine what is still "visible" is
altered such that weak hash-tables will not "count".

I'll be damned if I can say what they're good for.  I thought it would be
good for data that would become dated, but then I realized that for
reliability this would require a GC before each gethash, so that's not
right...they must be good for something, but what?  There couldn't possibly
be a useless feature in Common LISP, now could there?  :-)
"TANSTAAFL" Rich lynch@ils.nwu.edu