OC, oc Language
I. Reference Counter
1> stack and stack
2> Introduction
3> Basic Concepts
4> Basic Methods
Ii. multi-object memory management
1> basic usage
- When an object exists, the retain operation is performed on the object.
- When an object is discarded, the release operation is performed on the object.
- If the retain operation is performed, the release operation is performed.
2> memory management of the set Method
3> @ property impact on memory
4> loop inclusion and circular reference
Iii. autorelease
1> basic usage
2> usage notes
- The creation and release of the automatic release pool follow the stack rules.
- Calling the autorelease method does not affect the reference counter.
- The autorelease method delays the object release time. Do not use objects that occupy a large amount of memory.
- An object cannot call the autorelease method multiple times.
- An object cannot use both the autorelease method and the release method.
3> common applications
Quickly create an object that automatically releases the pool
① A class method is usually designed to quickly create an object in the Auto Release pool ② The method name usually starts with the class name ③ when the class is created, use self to call the alloc, init, and autorelease methods. Do not use the class name
Iv. ARC
1> basic usage
2> @ property's strong and weak Parameters
- The strong parameter is equivalent to the retain parameter.
- The weak parameter is equivalent to the assign parameter.