B
Bruce Wood
I think that the root of your misunderstanding (pardon the pun) is
that you seem to think that objects are garbage collected if they are
"marked for collection"...
Not true, and I don't see how you got that from my argument either.
Well, it was the only conclusion I could think of. Perhaps it's my
poor imagination.
You said that Nicholas was implying that "the initial sweep starts in
the topmost node of a tree." In fact, if there is no way to get from
the stack / static variable / etc to any part of the tree, then the
mark phase ("initial sweep") doesn't start anywhere in the tree. It
never sees the tree, which is what makes the tree eligible for
collection.
If the topmost node of the tree is the only object in the tree
referenced by anything outside the tree, and it is in fact referenced
by an object that is marked as not eligible for collection, then yes
the mark phase ("initial sweep") will traverse the tree starting at
the topmost node, because that's the first object reachable from the
collection of objects that has so far been marked as ineligible for
collection.
Anyway, everything that Nicholas has said so far has been accurate.
I'm trying to figure out where the disagreement is, and not having
much luck. :-(