Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C ARC vs. MRR: why the switch?

I am a new cocoa developer coming from a C#/Java background. I had been introduced to memory management patterns which objective-c language uses and I just find them very helpful for code-conscious development.

Why does Apple now want us to use ARC (Automatic Reference Counting) instead of MRR (Manual Retain-Release) and what advantages other than time saving does ARC offer?

I see such a transition negatively affecting good-citizen habits that developers gain from the obj-c ecosystem.

Nick

like image 224
Nicholas Credli Avatar asked Dec 18 '11 21:12

Nicholas Credli


1 Answers

It's unfortunate that making it easier for competent developers to be correct has a side effect of making it easier for new developers to not learn, but it seems like it's probably worth it.

ARC is less forgiving than a tracing collector like C# or Java use though. If you don't have a clear object ownership model you will almost certainly create cycles and leak tons of memory. My hope would be that this is made obvious enough (via Instruments? That still requires seeking it out... not sure what could be done here) that new developers will quickly learn to keep their object graph clear and acyclic.

like image 81
Catfish_Man Avatar answered Oct 22 '22 08:10

Catfish_Man