Memory Management Four--autorelease automatic release poolBasic use of 1.autorelease
- This object method places the object in an auto-release pool ;
- When the auto-release pool is destroyed , a release operation is made for all objects in the pool;
- This method returns the object itself ;
- After this method is called, the value of the object counter does not change until the auto-release pool is destroyed and the object is released once.
Benefits of 2.autorelease
- Without the time when the object of concern was destroyed;
- Do not care when to call the release operation;
use of 3.autorelease note
- Objects that occupy large memory do not use autoreleasecasually;
- Objects that consume less memory use autorelease without much impact ;
4. Wrong wording: Wild pointer error
- Call Alloc after calling the Autorelease, followed by the release of the call;
- multiple calls to autoreleasein succession;
5. Automatic release of the pool detail description
- During the operation of the iOS program, countless pools are created that are present in the stack structure (advanced).
- When an object calls the Autorelease method, the object is placed at the top of the stack;
other uses of 6.autorelease
- The system's own method contains no alloc, new, copy, indicating that the returned objects are autorelease;
- There are often some class methods in development that quickly create an already autorelease object:
7. Automatic release of pool creation
Dark Horse programmer----Memory management of four--"Autorelease Automatic release Pool"