If reference count of object is zero and if released is applied on that object what should happen? My application doesn’t crashes if do so.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The short answer is don’t. Even if it doesn’t currently crash, you’re looking for trouble in the future. Read Apple’s memory management guidelines. It really isn’t that difficult.
Basically, when the retain count hits zero the instance will be deallocated. When you the release it again, which object are you actually manipulating? If you’ve not allocated any more objects since the last release, maybe it’s the same one (though in an unknown state). Maybe it’s a different object that you’re releasing. The only way to be sure is not to do it. (Or set your instance to nil immediately after releasing it. That way any subsequent release will at least by harmless.)