ANN.: Beta 1.0 of Weak Reference Extension Module is now available

Johann Hibschman johann at physics.berkeley.edu
Thu Nov 16 08:15:07 EST 2000


shindich  writes:

> I suspect of two reasons for why Java has weak references:
> 1. Tracking down circular references is very expensive even for real
> garbage collectors. Therefore, you might get better performance if you
> use weak references instead of creating circular references.

But doesn't this come for free with most garbage collection schemes?
The classic "stop and copy" and "mark and sweep" collectors hangle
circular refs automatically.  I've done a bit of Common Lisp
programming and have never had trouble with GC performance, even while
running ugly numerical code.

> 2. The other reason is philosophical. You might have cases where your
> client code cannot control the lifetime of the referenced object. A
> weak reference represents sort of an entry in a DMV registry. The DMV
> has everyone’s address, but the database is never up to date.
> Therefore, it is possible that the person the DMV is trying to contact
> has either moved or, God forbid, died. In that case, DMV's letter will
> be returned back.  (I hope my example makes sense...)

I don't know.  This just sounds like a sign that you don't actually have
the object.  If someone can change the address and the object you have
doesn't change, you didn't have the address.  But I think I'm getting
a glimmer of an insight here, something involving multiple edits of
data without firm coordination.  Or something like that.

Thanks,

--J

-- 
Johann Hibschman                           johann at physics.berkeley.edu



More information about the Python-list mailing list