Take the 2-minute tour ×

I'm reading a book on Objective C, and I was wondering about 2 things:

  1. Should I take the time currently to read a whole chapter on memory management?
  2. If you are doing a really good job on manual management, can you get to better performance than using ARC?
share|improve this question

4 Answers 4

up vote 1 down vote accepted

You can do better, but you might also end up doing a lot worse (introducing leaks and crashes).

I'd say you should read about it, but use ARC as default anyway. When you have to, override ARC for certain files and manage your alloc's/releases by yourself.

I recommend Ray's article about memory management. It describes a few practices which helps a lot. Obj-C is more about "conventions" and consistency than language rules, so learning those conventions is a must if you're doing manual memory management.

share|improve this answer
+1'd for the recommendation to continue using ARC. Most of the time manual resource management is a micro-optimization. I also think it's also good advice to use caution and be diligent when doing MRC, but I need to reemphasize that it's not "scary" or even particularly hard. It can just require a bit more time and attention to detail. –  Ben Burns Mar 8 '13 at 15:45

To answer question one:

Regarding question two, you most definitely can do better than ARC. Automated resource management in any language is always a heuristic approach that can never interpret the intentions of the programmer 100%. When you opt to control this process, you will almost always have fewer alloc/free calls for a given run of your program. This means more efficiency, (usually) less memory fragmentation, and sadly, the unfortunate task of having to worry about memory leaks.

Memory management (and pointers/aliasing) tend to be taught to people with the stigma of difficulty. This is an awful mistake. These concepts are actually quite simple and fundamental to how the machine you're operating works. Face them head on and early, and you'll be a force to reckon with.

That said, unless you have a specific reason to use MRC, ARC will save you debugging time and let you write safer code faster.

share|improve this answer

Yes, you should read it. Automatic memory management of any kind is not magical; like any abstraction, it's not perfect and foolproof. When you're confronted with it's limitations or something difficult to understand, it pays to know what is going on behind the scenes. Moreover there are many third-party libraries that don't use ARC so you may not have the option of only using ARC.

share|improve this answer

As the other answers say you should read it to get an understanding of what it does and there are still a lot of non-ARC code out there in various projects you might want to use but I would like to point out that even though it is possible to beat ARC in performance you probably won't do it and the effort to do manual memory management could be spent elsewhere.

share|improve this answer

Your Answer


