Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C and ARC? Use or not to use? [duplicate]

when reading one of the iOS 5 book I've came across such information:

"While ARC makes it easier for you to write applications without worrying about object management, lot of third-party libraries still need to manually release objects. For this book, all the projects are created with ARC turned off (...)" .

I am new to iOS Development, and I am not sure how to interpret it. Understanding Memory Management for iOS seems to be quite (very) important thing, but should I understood, that ARC is just a nice feature and I have to start without learning it, because it so new it can be not supported or possible to use in many situations?

like image 382
guitar_freak Avatar asked Mar 05 '13 11:03

guitar_freak


2 Answers

Do yourself a favor, use ARC. This is by far the best addition to the language that has happened in the last five years. It lets you deal with memory management in a more declarative, rather than a procedural way, freeing you from writing a lot of "boilerplate code".

This is not to say that learning about manual memory management is unimportant: you should definitely know how it works, and be able to read the code written without ARC. But as far as your newly developed code is concerned, you should stay with ARC, because manual memory management wastes a lot of your development effort for nothing.

Better yet, get yourself another book: it appears that the authors did not have enough time to rework the examples for ARC, so they inserted a rather lame excuse about "other libraries out there".

like image 189
Sergey Kalinichenko Avatar answered Oct 06 '22 02:10

Sergey Kalinichenko


It is a personal choice.

If you use ARC, you are not bothered about memory management.

But if you know how to make a full-fledged app with MRC (Manual Retain count) then using ARC is not bad.

Even in ARC at some specific time, you need to allocate and release memory, therefore MRC must to be learnt.

like image 23
Anoop Vaidya Avatar answered Oct 06 '22 02:10

Anoop Vaidya