Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 24. Memory Management > Objective-C Reference Counting

24.2. Objective-C Reference Counting

While garbage collection is a far more elegant solution—neatly solving all three problems at once—it's a complex system, requiring significant resources, and has only recently matured. Pre-garbage collection Objective-C employed a simple alternative: reference counting.

Reference counting introduces the concept of owners: code or objects that hold a pointer to another object are said to own that object. When an object or block of code wants to hold a reference to an object, it first retains it. When it's done with the object, it releases it.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial