This paper mainly records the knowledge points of objective-c memory management;
1, Objective-c objects are allocated within the heap, and C Mallock and C + + similar, only int and other system variable allocation within the stack;
2, Objective-c No Java such a complex garbage collection mechanism, it uses a reference count, it can be understood that when the object is created, the pointer to the first address of the object is referenced elsewhere, if the addition of reference number plus one, minus one, and when the reference number is zero the system clears the variable. The internal should be the allocated address on the heap is re-set to valid, that is, it can be assigned to another object, the pointer to store the first address of the object is cleared, like the C language, free (PTR);p tr = null;
3, objective provide retain and release method, call the former reference count plus one, the latter minus one;
4, Objective provides autoreleasepool (auto-free pool) modifier, within this modifier scope, the system helps you maintain the memory allocation and release;
OBJECTIVE-C (Memory management)