Familiarize Yourself with Objective-C’s Roots

  1. All Objective-C objects must be declared in this way because the memory for objects is always allocated in heap space and never on the stack.The memory allocated in the heap has to be managed directly, where as the stack- allocated memory to hold the variables is automatically cleaned up when the stack frame on which they are allocated is popped.Sometimes in Objective-C, you will encounter variables that don’t have a * in the definition and might use stack space. These variables are not holding Objective-C objects, An example is CGRect. 一般的变量(int,float,double,char,etc.)都是存放在stack里边,特殊情况如一个对象的属性会存放在heap。

  2. In the messaging structure, the runtime decides which code gets executed. With function calling, the compiler decides which code will be executed.the compiler doesn’t even care about the type of the object being messaged. That is looked up at runtime as well, through a process known as dynamic binding.

  3. These two variables are of type NSString*, meaning that the current stack frame has allocated 2 bits of memory the size of a pointer (4 bytes for a 32-bit architecture, 8 bytes for a 64-bit architecture)