Circular references in Javascript / Garbage collector
Any half-decent garbage collector will handle cycles. Cycles are only a problem if you do naive reference counting. Most garbage collectors don’t do ref-counting (both because it can’t handle cycles, and because it’s inefficient). Instead, they simply follow every reference they can find, starting from “roots” (typically globals and stack-based variables), and mark everything they … Read more