Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
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.
| Memory-Related Method | Description |
|---|---|
| +alloc | Allocate memory for new object and assign the object reference count of one. |
| −autorelease | Add receiver to autorelease pool. |
| −dealloc | Deallocate memory for an object with zero reference count. |
| −release | Decrease object’s |
| −retain | Increase object’s |
| −copy | See documentation. |