Daily iOS
Memory and ARC

ARC vs garbage collection

iOS manages memory with reference counting (ARC). If you had to implement automatic memory management without reference counts, what approach could you take?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

The alternative is tracing garbage collection. It periodically marks the objects reachable from the roots (stack, globals) and sweeps the rest, has evolved into generational and concurrent collectors, and handles reference cycles automatically.

Share a question