Possible Duplicate:
Garbage collector and circular reference
Is there any impact on GC performance if objects have a circular reference but are otherwise unattached to any root, and thus ripe for GC?
Would there be any benefit in having a weak ref in one direction?
Is there any impact on GC performance if objects have a circular reference
No. The sweep process stops when it encounters an instance already visited. There is no diff with non-circular structures.
but are otherwise unattached to any root, and thus ripe for GC?
In that case they will not be visited at all, making it totally irrelevant how many cross links there are.
If the objects can't be reached from the root, they will not be traversed, so a circular reference won't be an issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With