Quote:
Originally Posted by MatuX
And what if the property is set to assign instead of retain? When I do "release" I will render the allocated memory unusable?
Must I check for every property if its set to assign or retain every time I use it?
|
Nope. That's not your job. Your job is to balance your own retains and releases. (Of course, if you wrote the class that's getting the property, you're responsible for making it sure it works correctly.)
Release does not necessarily deallocate the object - only if its retain count drops to zero.
If you alloc an object, then assign it to a property of another class, you can go ahead and release it when you're done with it. It's up to the other class to have retained it (if it needs to). You shouldn't worry about it. Remember, as long as there's at least one retain on it, the object will not go away.
If you're worried about premature releases, check out the NSZombieEnabled flag.
FCS Blog NSZombieEnabled for the debugger adverse