Objective-C style question: do "release" or "nil" properties in dealloc?
- by Piotr Czapla
Hi,
Apple usually release ivars in dealloc but is there anything wrong with nilling the properties in dealloc?
I mean instead of this:
- (void) dealoc(){
[myRetainedProperty release];
[super dealloc];
}
write code like this:
- (void) dealoc(){
self.myRetainedProperty = nil;
[super dealloc];
}
I know that it is one additional method call but on the other hand it is safer as it doesn't crashes when you change your property form retain to assign and forget to amend dealloc.
What do you think? Can you think about any other reason to use release instead of setting nil besides performance?