My argument wasn't to go and be naive about memory management. It was to not worry about it right now. Memory management makes the already steep learning curve of Objective-C even steeper, and can scare away newcomers.
My argument wasn't to go and be naive about memory management. It was to not worry about it right now. Memory management makes the already steep learning curve of Objective-C even steeper, and can scare away newcomers.
The other reason people are careful about autoreleases is because, obviously, objects in the autorelease pool won't get deallocated until the pool is drained, which normally happens in the main application loop. Normally, this is not a problem, but if you do memory-intensive things (like dealing with images or other media) in a loop that means that you will consume a lot of memory before the autorelease pool gets drained. This might get other apps killed (on iOS 4+), and ultimately, yours too.
If you're already in the habit of autoreleasing everything you +alloc, why not just release it when you're done with it instead?
UIView* view = [[UIView alloc] init]; ...do a bunch of stuff [view release] <-- you have to remember this
vs. UIView* view = [[[UIView alloc] init] autorelease];
Of course I know about the cases where we have tight loops,w hich is why i said 99 of the time.