
This is handled by the OS (both in IOS and MacOS X) with a system called Automatic Reference Counting (ARC).
Xcode even includes a function to upgrade your projects (both MacOS X and iOS) to ARC: it will NOT modify your objective-C code (so you don't get lost), but it will ignore the unnecessary code at compile time.
ARC will be activated by default for your new projects.

