|
|
>>> Circular references seem to be a bit like goto: You can come up with all
>>> kinds of situations where it's "necessary", but in practice it happens
>>> rarely if at all.)
>
>> I disagree. Doubly-linked lists, trees with pointers up the nodes,
>> widgets with child widgets that have parent pointers, etc. Pretty much
>> everything "OO" is good at winds up generating circular references.
>
> Yet, as I said, languages like PHP and Objective C seem to use
> reference counting without too many problems.
Well given a long chain of objects pointing to objects, and a pure
reference counting system, each scan of the GC will only reclaim *one*
object from the chain. If the chain is long, it could take a damn long
time to reclaim all that memory.
Reference counting really is far too simplistic to work properly. I have
no idea how other languages appear to make it work [probably by
suplimenting it], but I wouldn't trust it as far as I could throw it. ;-)
Post a reply to this message
|
|