官术网_书友最值得收藏!

ARC – what is that?

Automatic Reference Counting was introduced at the 2011 WWDC, in Session 323. If you want to see the original presentation, feel free to visit https://developer.apple.com/videos/play/wwdc2011/323/

ARC is made possible by Clang and LLVM. LLVM and Clang are two technologies that enable compiling C, C++, and Objective-C code. LLVM is also used alongside the Swift compiler. With ARC, a Clang feature, developers don't have to write the tedious retain and release calls. There are multiple benefits to letting the compiler handle it, as follows:

  • Memory management is difficult
  • The compiler is often more correct than you are
  • There are fewer lines of code to write
  • It has the same performance as manual reference counting

With Swift being a modern language and the successor of Objective-C, you've never had to call retain. Swift programs leverage ARC, in order to simplify memory management. In Swift, there are multiple memory management concepts to master, and we'll cover them in this section.

主站蜘蛛池模板: 永平县| 洞口县| 临夏县| 都匀市| 古蔺县| 乌审旗| 泰安市| 洞口县| 旬邑县| 克什克腾旗| 彰化市| 淄博市| 浪卡子县| 怀来县| 称多县| 榆中县| 彭泽县| 兰溪市| 泸水县| 寿宁县| 大城县| 绩溪县| 和静县| 荃湾区| 宝鸡市| 上饶市| 萝北县| 运城市| 龙游县| 东丽区| 饶阳县| 蓬溪县| 伊宁市| 柳州市| 太保市| 温泉县| 博野县| 平远县| 乐山市| 吐鲁番市| 霍林郭勒市|