Attention all Mac developers! You know how when your city changes its trash-collection policies it leads to months of confusion? That’s about to happen on the Mac App Store: If you want to continue selling apps there, you’ll have to switch how you collect your garbage.
On Friday, Apple posted a notice to its developer portal, asking app devs to make sure that their Mac App Store submissions use Automatic Reference Counting (ARC), instead of garbage-collection memory management.
Garbage collection is a feature in Objective-C 2.0. In computer science, garbage collection is a form of automatic memory management, in which a garbage collector attempts to reclaim memory that is occupied by objects that are no longer being used by a program.
Apple deprecated Garbage Collection in OS X 10.8 Mountain Lion, in favor of ARC, which provides a more efficient form of automated memory management with Objective-C. Now Apple’s putting its foot down, insisting that devs transition to ARC before May 1 if they want to continue selling or updating their apps on the Mac App Store.
To make the transition easier, the migration assistant in Xcode can help convert garbage-collecting apps to ARC. By most accounts, ARC looks like it’s more efficient, and should help with speedier apps, so this is a win-win for everyone.
Source: Apple Developer Portal
One response to “Apple changes the way it collects garbage on the Mac App Store”
I read this and while the title encourages people to read the article like any good journalist would do, it uses a topic and elaborates it completely wrong. Clearly the author is not a developer on Xcode, so he gets off the hook however intermixing the concept of garabage collection and emphasizing Apple is stopping garbage collecting is completely, and to a certain extent, embarrassingly wrong.
Much like the C programming language, Xcode and objective-c programmers need to explicitly mark when they would like to keep a variable in memory and when they no longer need it with they key words “retain” and “release”. Because of all the different ways a variable can be passed around, sometimes it may be confusing and difficult for the developer to determine if a variable should be retained or released.
With automatic reference counting (ARC) this explicit need to call retain and release on variables was eliminated. This does not mean however that all of a sudden OSX is performing garbage collection, which is normally a separate process going around at runtime picking up and freeing memory. Instead, at compile time, the compiler is smart enough to know when to automatically inject the retain and the release keywords throughout the code on behalf of the of the developer.
The use of ARC has proven to be effective in minimizing memory leaks and improving overall quality and Apple is simply now requiring its use.