I know there is an autorelease pool created in the main method and all the objects that receive autorelease message get stored in this pool and get released when the pool drains out.
But it is always said to avoid autoreleasing objects to avoid memory leaks and in turn app crashes.
Then why and in which conditions should we use autoreleasepool?
Apple docs suggest that we need to use them when we are using threads so in the beginning of a thread we need to create an autorelease pool and in the end of the thread drain it but what if we are not creating an autorelease object in the complete thread then in that condition also is it necessary to create an autoreleasepool in the beginning of the thread.
Please clear out my confusion. Thanx.