Select root to mark. A references B. C and D reference each other, but neither is connected to a root.
Or select C first to connect the cycle to a root.
Mark-and-sweep follows root → A → B and preserves both objects. The unreachable C ↔ D cycle is reclaimed. This is an algorithm illustration, not a browser GC trigger.
A model, not a browser GC trigger · Algorithm reference ↗