One, the NSObject class provides a autorelease method:
-(ID) autorelease;
This method pre-sets a release message to be sent at a later time, and the return value is the object that receives the message. The retain message uses the same technique to make nested calls easier. When you send an autorelease message to an object, you are actually adding the object to NSAutoreleasePool. When the auto-free pool is destroyed, a release message is sent to all objects in the pool.
Two
NSAutoreleasePool *pool;
Pool=[[nsautoreleasepool Alloc]init];
...
[Pool release];
When you create an auto-free pool, the pool automatically becomes the active pool. When the pool is released, its retention counter value is 0, and then the pool is destroyed. During the destruction process, the pool releases all of its contained objects.
When you use AppKit, cocoa automatically creates and destroys auto-free pools for you on a regular basis. This is usually done after the program finishes processing the current event, such as a mouse click or key. You can use as many auto-releasing objects as you like, and when you no longer use them, the auto-free pool will automatically clean up those objects for you.
Third, you may have encountered another way to destroy objects in the auto-release pool in Xcode's auto-generated code: the-drain method. This method simply empties the pool automatically and does not destroy it. The-drain method is only available for Mac OS X 10.4 and later. In the code we write ourselves (not generated by Xcode), we use the-release method because it works for all versions of Mac OS.
Reference: "Object-c Basic Course"
"Reading notes" ios-automatic release Pool