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

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.

主站蜘蛛池模板: 利辛县| 昔阳县| 呈贡县| 北川| 永清县| 榆中县| 宁阳县| 柏乡县| 江津市| 甘肃省| 弥勒县| 抚顺县| 泽库县| 奈曼旗| 定陶县| 香格里拉县| 宜宾市| 屏南县| 金阳县| 游戏| 永康市| 沂南县| 鹤壁市| 登封市| 图们市| 涞源县| 曲松县| 长宁县| 滨州市| 通化市| 兴和县| 托里县| 长春市| 额尔古纳市| 光山县| 乌兰浩特市| 怀仁县| 五华县| 宜昌市| 囊谦县| 漠河县|