## Re: weak HTs

 Re: weak HTs From: Bruno Haible - 2004-04-30 20:58:28 ```Sam wrote: > E.g., A=(B . dataA), B=(A . dataB). > As soon as _both_ A & B are not visible from the outside, they both can > be collected (== removed from the HT), but as long as either is alive, > both are alive (and must remain the HT), handling of :BOTH is indeed a > "GC inside a GC". Yes. > i.e., two passes are needed: first we mark everything the usual way, then > we mark all children of elements of :BOTH HTs (but not the elements > themselves!) When you do this, you cannot reclaim a cycle between A and B. I.e. when A contains a slot pointing to B, and contains a slot pointing to A, but A and B are not pointed to from outside, you would fail to reclaim them. Therefore forget about the concept of "mark all children of an element but not the element itself". It's broken. No good GC algorithm works this way. Can you formulate a non-broken algorithm how to handle this :BOTH case? May be O(N^2). We'll see how to optimize it afterwards. Bruno ```