Showing posts with label Memory Management. Show all posts
Showing posts with label Memory Management. Show all posts

Thursday, October 3, 2013

Memory Management in Objective C

In this topic, we will discuss Reference Counting and some other memory management topics related to Objective C.

Reference Counting


Reference Counting is a technique of storing a number of reference to an Object at any given state. As soon as the reference count goes to the Zero object is released from the memory. It is important from the development point of view of application where memory is critical and to maintain responsiveness. It is the most simple algorithm for memory management. 

Objective C provides two methods of Memory Management

  1. MRR - Manual Retain-Release: In this method, you explicitly keep track of the Objects you own. 
  2. ARC - Automatic Reference Counting uses the same algorithm of MRR, However, while using ARC Compiler insert appropriate statements in your code at compile time.