[DUG] Related try..finally question
Paul Heinz
paul at accredo.co.nz
Fri Jul 21 15:28:19 NZST 2006
Todd wrote:
> You still need to worry about "loiterers" though.
>
> eg. Object A refers to object B, which holds a reference back to
> object A.
> Unless one of those references is explictly set to null, before
> objectA or
> object B goes out of scope, the objects are never garbage collected....a
> kind of memory leak!
Circular references are only a problem for reference counted garbage
collection (e.g. COM) and thus are seldom used in modern designs. Mark and
Sweep style garbage collectors are used instead which solve this problem
using reachable object discovery from known roots. Admittedly, this comes at
a higher performance cost than reference counting. Hence the shift towards
Generational and Type-based (or Precise) garbage collectors so mititgate the
Mark/Sweep costs.
TTFN,
Paul.
More information about the Delphi
mailing list