I found this very useful definition here:
When you autorelease, you're basically saying: "I don't need this any longer, but anyone else is free to pick it up (before the auto release pool is drained)". When you explicitly relase an object you're saying: "I don't need this any longer and unless anyone else has already said otherwise (acquired), it should be deallocated immediately."
Consequently, autorelease is not normally the wrong thing to. It is required when you want to pass objects back to the sender of a message without requiring the sender to take care of releasing the object.
However, I am still wondering what the second paragraph means. Autorelease is not normally the wrong thing to do... I thought it's really memory intensive, so it should naturally be the wrong thing to do. But as for the last sentence, I'm afraid I don't get it.
When do I really need to use autorelease and what would be a good example / rule of thumb that beginners can easily remember?
Thanks for any suggestions.
See Question&Answers more detail:os