Release and Autorelease are the terms related to the Memory Management. whenever you own a object its your responsibility to release it . if you don't release it properly, Objective -C cannot reclaim it for the use of other objects and there will be a memory leak.
Different ways to own a object are alloc, new , retain and copy Whenever you use this things try to release it so Objective C will take care blowing that object. If you are not sure about releasing that object, please make sure you do autorelease.
Whenever you do autorelease of an object the object is not released right way, it will be added to the Autoreleasepool in the main function. The Autoreleasepool in the main function will maintain a stack of objects to be released and they are released one by one when "drain"method is called eg: [pool drain]. Drain method is called repeatedly at the end of every event loop.
what is the event loop?
For instance when you click on the button in the application, button goes and performs what needs to done and comes back to the normal state of the app this is considered as one event loop.
Different ways to own a object are alloc, new , retain and copy Whenever you use this things try to release it so Objective C will take care blowing that object. If you are not sure about releasing that object, please make sure you do autorelease.
Whenever you do autorelease of an object the object is not released right way, it will be added to the Autoreleasepool in the main function. The Autoreleasepool in the main function will maintain a stack of objects to be released and they are released one by one when "drain"method is called eg: [pool drain]. Drain method is called repeatedly at the end of every event loop.
what is the event loop?
For instance when you click on the button in the application, button goes and performs what needs to done and comes back to the normal state of the app this is considered as one event loop.