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

Summary

In this chapter, you learned what memory management in Objective-C is and how it works. You also learned the best practices while working with Manual Retain Release, and got an introduction to Automatic Reference Counting, Objective-C Objects, and root classes. ARC basically can be considered as a compile time guard against memory leaks as the compiler will automatically write the release statements for you at compile time. So, there is no need to write verbose release statements in your code to keep it clean and terse.

One tip to note for coding with memory management is that whenever you do alloc and init, then write your release code after that and put it in its appropriate place in your class, you can forget to call the release method after writing some or fixing some bugs. So writing your object release statements after you do alloc and init will help you to keep memory leaks to a minimum so that you won't have a situation where you get a memory leak as you have forgotten to write your object release statement.

In the next chapter, you will learn more about ARC, how it works, its advantages, how to set up your projects to use ARC and memory models in Objective-C and UI Kit with ARC.

主站蜘蛛池模板: 德安县| 根河市| 德令哈市| 泊头市| 贞丰县| 武夷山市| 吐鲁番市| 长武县| 南陵县| 武威市| 绥滨县| 嫩江县| 张家界市| 碌曲县| 卫辉市| 泽普县| 常宁市| 富蕴县| 玛沁县| 宜川县| 镇沅| 保德县| 九台市| 绍兴县| 依安县| 新昌县| 咸丰县| 孟津县| 建平县| 岢岚县| 田林县| 开封市| 长海县| 沙雅县| 玛沁县| 庆城县| 资源县| 临颍县| 武清区| 攀枝花市| 平阴县|