How does reference counting work?
While there is currently no automatic garbage collection for gcc’s Objective-C, reference counting takes some of the workload away from manual memory management. Objects descended from NSObject have an intrinsic reference count which starts at 1. If you depend on an object staying around, send it a -retain message. When you are done, send it -release . An object will not be deallocated until its reference count reaches 0. A good article on reference counting is Hold Me, Use Me, Free Me.