Reputation: 461
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.
Upvotes: 0
Views: 59
Reputation: 52565
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.)
Upvotes: 1