retain count in iphone

前端 未结 3 1764
小蘑菇
小蘑菇 2021-01-24 04:15

I have used [anArray retainCount] to get the retain count of array..(i know this should not be used but i am using just for learning retain concept)

Follow

3条回答
  •  粉色の甜心
    2021-01-24 04:37

    This line... anArray=[str componentsSeparatedByString:@","];

    You squished the original assignment of 'anArray' (thus creating a leak). In real life, you'd want to [anArray release] first. That's why the retain count went back to 1.

提交回复
热议问题