Discarding a reference chain

I’m not sure what to call this so I had a real bad time googling for it, but if you have some (custom non unity) objects that all hold references to each other but are “out of play”, does C# know how to manage that or do we need to help him by nulling everything out?

public class TypeA {

    TypeB myVar;
}

public class TypeB {

   TypeA myVar;
}

lets say these two reference each other and I hold a reference to them(one or both of them) on some master class, what happens if I just null out the master class reference? does it recognize it is no longer connected to the program and send out a garbage truck?

does this behavior have a name or anything?
thanks in advance! (;

The garbage collector can detect and clean up orphaned objects with circular references. No need to worry.

1 Like

Circular reference! I knew it had a name, thanks bud