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

Re: Hash Tables and GC



    Date: Wed, 7 Sep 88 13:02 PDT
    From: DDYER@RIVERSIDE.SCRC.Symbolics.COM

	Date: Wed, 7 Sep 88 15:49 EDT
	From: Michael Greenwald <Greenwald@STONY-BROOK.SCRC.Symbolics.COM>

	    Date: Wed, 7 Sep 88 11:52 PDT
	    From: DDYER@RIVERSIDE.SCRC.Symbolics.COM


	    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

	How does this tell you whether there *are* any non-weak pointers to the
	object in question?  

    The main point of the desire for weak pointers is to free storage being
    held by the pointers.   

weak-pointers also allow you to hold on to a pointer that may be useful
if and only if someone else is also interested in the object.  If
"strong" pointers exist to the object then you definitely want to keep a
weak pointer to it.  If not, you could have just cleared the pointer at
any point and it would have been GC'd in the next flip.

			    SI:GC-EVERY-FLIP-LIST can't tell you that
    removing a pointer will definitely free storage, but it does let you
    remove pointers that you don't need and that you know will probably free
    storage.

    For example, I've used it to empty the free pool of a resource, and I've
    used it to "clean" a cache of all obsolete items.