Refcounting GC
A garbage collector's job is simple to state and tricky to implement: automatically free heap memory once nothing needs it anymore. Reference counting is the simplest strategy, every Obj tracks how many places are pointing at it, and frees itself the moment that count hits zero.
The rule every piece of code has to follow religiously: call objRetain whenever you store a new reference to an object (assign it to another variable, put it in a list, etc.), and objRelease whenever that reference goes away.
The fatal flaw: cycles
Refcounting has one well-known blind spot, if object A holds a reference to B, and B holds a reference right back to A, their counts can never reach zero, even if nothing outside the pair references either of them anymore. That memory leaks forever. This isn't a bug you can patch, it's fundamental to how refcounting works, which is exactly why the next lesson introduces a completely different strategy.
TIP
This exact tradeoff is why Python uses reference counting plus a supplementary cycle detector, and why some languages (like the one you're about to build a collector for) choose mark-and-sweep instead, no cycle problem, at the cost of needing to pause and scan everything periodically.