2 ms·
"Also, in Objective-C you should never user the Garbage Collection feature." Why not? On the Mac, the garbage collection process is offloaded to another CPU. A
by AshFurrow 15y ago
"Also, in Objective-C you should never user the Garbage Collection feature."
Why not? On the Mac, the garbage collection process is offloaded to another CPU. Any performance hit is more than made up for the fact that developers probably messed up the retain counts.
Memory management is a thing that you have to get perfect or your app will crash. I personally trust ARC or GC more than I trust myself.
- cpeterso 15y agoiOS's Objective-C doesn't support garbage collection. iOS 5 will add support for Automatic Reference Counting, but no real garbage collection. So if you are writing cross-platform Objective-C code that must support iOS devices and Macs, then you can't rely on garbage collection. And if you must support iOS < 5, then you can't rely on Automatic Reference Counting either.
- shadowfiend 15y agoNot quite right. There is some support for ARC for iOS 4 (that is bundled with the compiled app). Some more at http://stackoverflow.com/questions/6308425/ios-5-best-practice-release-retain http://stackoverflow.com/questions/6308425/ios-5-best-practi... .
- leon_ 15y agoIt's foreseeable that GC will go the way of the dodo in one of the next OS X releases. (They didn't mention GC once at the WWDC talks. Not even in the memory management related talks.) > I personally trust ARC or GC more than I trust myself. I don't. Reference counted memory management is so easy that I never had the problem of leaking/crashing apps because of forgotten retain/releases. The most common memory management related bug for me are hidden retain cycles. (Which ARC doesn't really address.) But ARC is pretty nice for the stupid UI boilerplate code which saves you from writing huge -dealloc methods. For critical code (Obj-C and C intermixing) I tend to disable ARC.