dealloc, use release or set to nil for properties?

前端 未结 1 772
挽巷
挽巷 2020-12-06 11:13

I have noticed a little confusion when looking at various bits of code both in books and on the web when it comes to implementing dealloc. My question is when using @propert

相关标签:
1条回答
  • 2020-12-06 11:25

    There is no real difference, Unless you are not using the @synthesize keyword. When you set the properties to nil, they are being released behind the scenes by the setter. Now, there may be a slight performance increase over the fist version, because not so much needs to happen behind the scenes (e.g. pointer comparison, and everything else apple hides behind the scenes). I always use version 001, because it is more to the point and future developers don't have to dig though my code to figure out what I am accomplishing.

    0 讨论(0)
提交回复
热议问题