Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kainjow

Moderator emeritus
Original poster
Jun 15, 2000
7,958
7
For those who haven't heard, there is a new way of dealing with memory management in Cocoa starting with 10.7/iOS 5 called Automatic Reference Counting (ARC) that has just been made public.

From the spec:
Automatic Reference Counting implements automatic memory management for Objective-C objects and blocks, freeing the programmer from the need [to] explicitly insert retains and releases.

One addition to this change is the @autorelease{} statement that replaces the need to use NSAutoreleasePool.

Should be some welcomed improvements.
 

Blakeasd

macrumors 6502a
Dec 29, 2009
643
0
It seems stupid though that IOS devs get it first with Xcode 4.2. I pay $99 for the Mac program, yet IOS devs pay $99 and get it first. :mad:
 

chown33

Moderator
Staff member
Aug 9, 2009
10,761
8,460
A sea of green
Mac programmers already have full garbage collection. For free. Right now. Works on 10.5 and 10.6. 32-bit and 64-bit.

I don't see that this adds a lot.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
Mac programmers already have full garbage collection. For free. Right now. Works on 10.5 and 10.6. 32-bit and 64-bit.

I don't see that this adds a lot.

I have only looked at this briefly, but I can see this bringing in the coding convenience of garbage collection without the runtime overhead.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
Mac programmers already have full garbage collection. For free. Right now. Works on 10.5 and 10.6. 32-bit and 64-bit.

I don't see that this adds a lot.

It's very useful if you have code that you share between MacOS X and iPhone / iPad. I do, which meant no garbage collection in MacOS X for me because it doesn't work on the iPhone.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
https://forums.macrumors.com/threads/1164724/

Mac programmers already have full garbage collection. For free. Right now. Works on 10.5 and 10.6. 32-bit and 64-bit.

I don't see that this adds a lot.

It removes the run-time overhead of garbage collection. This can be quite significant, especially in performance critical code. As ARC is done at compile time you get the full performance of the reference counted environment without managing retain/release yourself.
 

GorillaPaws

macrumors 6502a
Oct 26, 2003
932
8
Richmond, VA
While this is great news, there's a sick part of me that likes reference counting. Retain/release memory management forces me to always consider each object's lifecycle and the interaction/ownership of the object graph. I also like driving cars with manual transmissions if that tells you anything. If I were a better programmer, I would probably be more excited about GC and ARC, because memory management does become tedious.

In theory, will this open up the door for some further new innovations in the Static Analyzer that were previously impossible?
 

amorya

macrumors 6502
Jun 17, 2007
252
7
It seems stupid though that IOS devs get it first with Xcode 4.2. I pay $99 for the Mac program, yet IOS devs pay $99 and get it first. :mad:

If you pay for the Mac program, you should be able to download Lion (required) and Xcode 4.2.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
If you pay for the Mac program, you should be able to download Lion (required) and Xcode 4.2.

XCode 4.2 is only available under iOS SDK beta, therefore it's only available to paid iOS developers. Even though there are versions for both Snow Leopard and Lion, and ARC works under Mac OS X as well as iOS. The Mac OS X Lion part of Mac Dev Centre still only has XCode 4.1 DP6, I would expect that to change to XCode 4.2. I can't see any reason for restricting Mac OS X developers to XCode 4.1.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.