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
  • PrintPrint
Share this Page URL
Help

Chapter 3. Just Enough Objective-C: Part... > Managing Memory Using Retain and Rel...

Managing Memory Using Retain and Release

Unlike in Java or C#, when programming for iOS, you manage memory manually; there is no garbage collection on iOS devices. Although as of OS X 10.5, Cocoa includes an option to use automatic garbage collection, this option is not available on iOS devices. Table 3-1 summarizes Objective-C’s memory management methods.

Table 3-1. NSObject Memory Management–Related Methods
Memory-Related MethodDescription
+allocAllocate memory for new object and assign the object reference count of one.
−autoreleaseAdd receiver to autorelease pool.
−deallocDeallocate memory for an object with zero reference count.
−releaseDecrease object’s
−retainIncrease object’s
−copySee documentation.



  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint