Re:Garbage Collection is Wrong
by letzjuc on Thursday February 27, 2014 @04:47PM
(#7315366)
I fail to see why you need cycles' support for that.
[ Parent
| on HN ]
You asked for a situation where the lifetime of a resource can't be directly tied to the lifetime of a single storage location. Cycles are a different matter.
>You asked for a situation where the lifetime of a resource can't be directly tied to the lifetime of a single storage location.
I don't think I asked for that but correct me if I did (maybe I'm just not understanding your point).
Anyways, could you elaborate why shared_ptr, unique_ptr, and weak_ptr don't work in that case?
Oops, wasn't you, but the OP I was responding to initially.
shared_ptr works fine for my example. Shared immutable state is a case where reference counting works extremely well, since immutability implies no cycles.