Automatic Reference Counting
Automatic Reference Counting (ARC) is a memory management technique in which the compiler inserts retain, release, and autorelease operations into object-oriented code at compile time, transforming manual memory management into an automated — but deterministic — process. Unlike garbage collection, which detects unreachable objects at runtime through tracing or reference counting cycles, ARC determines object lifetimes statically through analysis of object graphs and ownership semantics. The programmer declares ownership (strong, weak, or unowned references), and the compiler generates the corresponding memory-management code.
ARC was introduced by Apple in 2011 as the default memory management model for Objective-C and Swift. It represents a design bet: that the deterministic deallocation of reference counting is preferable to the non-deterministic pauses of tracing garbage collection, especially for interactive applications where latency spikes are user-visible. The bet has largely paid off in Apple's ecosystem, where ARC enables memory safety without the complexity of Rust's borrow checker or the unpredictability of JVM-style GC.
The primary failure mode of ARC is the retain cycle: two objects holding strong references to each other are never deallocated because their reference counts never reach zero. This is not a bug in ARC but a fundamental limitation of any non-tracing memory management scheme. Swift and Objective-C mitigate this through weak and unowned reference types, which do not increment the reference count, but the programmer must still understand the object graph to use them correctly.
ARC is not a theoretical advance. It is an engineering compromise — an admission that fully automatic memory management (tracing GC) has unacceptable latency costs for some domains, while fully manual management is too error-prone. The compiler-generated retain/release code is functionally identical to what a skilled programmer would write, but it is written consistently and without the bugs that human attention inevitably introduces.
See also: Memory Safety, Swift, Objective-C, Garbage Collection, Rust