Question about Garbage Collection

I’ve included a diagram below to demonstrate the scenario I am curious about. It shows the object relationships at Time A and Time B.

From my reading, objects are kept alive if they have a link back to a root object.

The question is, what happens to object ‘Parent 1’ and ‘Child 1’ in the second diagram below when ‘Parent 1’ no longer has a connection to a root object?

I assume ‘Child 1’ stays alive…but I don’t know what happens to ‘Parent 1’.

Garbage collection works differently based on various factors. in the case above, it appears that Parent 1 would no longer be referenced by anything, and would therefor be eligible for garbage collection. That doesn’t mean it will be, though, just that it’s eligible.

Just to be sure - are you referring to C# objects? or Unity “game objects” ? Mono (C#) uses a garbage collector; Unity probably uses other techniques for cleaning up unreferenced objects.

Yes, I am referring to C# objects.