i have used autorelease throughout my app and would like to understand the behavior of the autorelease method. When is the default autorelease pool drained? is it based on a
It is drained whenever the current run-loop finishes. That is when your method and the method calling your method and the method calling that method and so on is all done.
From the documentation:
The Application Kit creates an autorelease pool on the main thread at the beginning of every cycle of the event loop, and drains it at the end, thereby releasing any autoreleased objects generated while processing an event