This question aims to understand Objective-C’s manual memory management currently, and its use in the past.
It is said that people who worked with Objective-C for many years almost treat memory management in Objective-C like a “reflex”… (the alloc, retain, release, autorelease)
But isn’t it true that if Objective-C is used on a computer, then there is garbage collection? Isn’t it true that manual management in Objective-C isn’t needed until the recent use of it on iPhone and iPad because iOS has no garbage collection? How about in the past, maybe back in the 90s, when Objective-C has no garbage collection, or does it always have garbage collection but since the iPhone came out, then the retain and release were added to the language?
To answer the question you actually asked, Objective-C only gained garbage collection with the release of Mac OS X 10.5 Leopard in (late) 2007. Prior to that, manual memory management was the only option. Even after the release of Leopard, most Cocoa developers didn’t use garbage collection for various reasons: inertia of existing codebases, need to support older OS versions, performance penalties inherent in using garbage collection, not supported on iOS, etc.
ARC has been adopted more quickly for several reasons, and I (and obviously Apple) think it’s a much better solution than garbage collection. ARC was made available with the release of iOS 5.0 and Mac OS X 10.7 Lion (with partial support for deploying to iOS 4.3 and Mac OS X 10.6). Lion and iOS 5 were both released less than a year ago, so any developers who have been writing Objective-C longer than that use/used manual reference counting, and you’re correct that it’s reflexive for most of us.
While ARC has been adopted quickly, at least compared to garbage collection, its use is still far from universal. Anyone needing to support iOS 4.2 or earlier or Mac OS X 10.5 or earlier still absolutely has to use manual reference counting. Also, I think there are a lot of seasoned Cocoa programmers who simply haven’t seen a reason to switch to ARC yet, since for them, manual reference counting isn’t a huge burden.