I'm going to respectfully disagree with everyone who has answered so far and tell you not to immediately dismiss garbage collection on the Mac. All of my Mac applications use garbage collection, and all new applications I build will do so.
Where garbage collection has saved me a tremendous amount of trouble is in heavily multithreaded code. I consider myself fairly sound when it comes to memory management, but edge cases involving release and autorelease across threads were leading to occasional crashes in a massive piece of robotics control software until I converted it to garbage collection. All of those problems went away afterward, leading to far greater stability overall (I went for six months without seeing a crash on one of the more recent versions).
If developing code that will be shared between Mac and iOS, definitely write following the standard memory management rules so that you keep up your good habits and guarantee that things can be copied and pasted back and forth. You can then enable garbage collection as a build-time setting in the Mac version to act as a safety net for those cases where you missed a leak or overrelease. You won't be saving on code this way, but this might improve the stability of your application when deployed to your users.
However, there are certain frameworks, like Core Image, that don't play well with garbage collection, so if you use one of those in your application you may need to avoid GC.
As Mike Ash points out in his article "Perform Better With Garbage Collection", the fact that the garbage collector operates on a background thread can lead to slight performance improvements with certain applications on multicore Macs. For example, it can prevent halts in the main thread that you sometimes see in tight loops as autorelease pools are being drained, or other objects are deallocated.
Finally, I like testing crossplatform Cocoa code of mine under garbage collection to identify where I've put non-memory-related cleanup code in -dealloc
(where it really doesn't belong), because -dealloc
is no longer called under garbage collection. This helps me to better architect my code.