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

Re: Weak pointers and GC

I wrote:

>   I have a question about something that's not specified in T that people on
>   T-DISCUSSION might want to think about.  The question is what GC does to
>   entries in the weak pointer table (ie, the OBJECT-HASH table) that are NOT
>   GC'ed.  Objects in the table that are GC'ed obviously go away (that's the
>   whole point of the table).
>   As of now (T3.1) it seems that the table is cleared upon GC. For example,
>   when I enter
>	   (let ((x (object-unhash 69))) (gc))
>   the object that was in (OBJECT-UNHASH 69) will not be GC'ed (because it is
>   referenced in the current lexical context by X), but it will no longer be
>   accessable through OBJECT-UNHASH.

David Kranz wrote:

>Your explanation is not correct.  You are calling GC tail-recursively and so
>the environment containing x is not seen by the gc.  Try:
>	   (let ((x (object-unhash 69))) (gc) t)

Yep, that works.  I guess the compiler was too smart for my own good.

Sorry for the premature post.

Bruce Krulwich