I set in my interface.h a property as
@porperty(nonatomic, retain) *foo;
If i don't use this ivar in my implementation should I release it in dealloc ?
I set in my interface.h a property as
@porperty(nonatomic, retain) *foo;
If i don't use this ivar in my implementation should I release it in dealloc ?
Yes:
- (void)dealloc
{
// Other release code
[_foo release];
[super dealloc];
}
EDIT: Thanks to @borrrden for the tip about avoiding setters during dealloc
.
yes you should release
for release you can write like this :
- (void)dealloc
{
// other release stuff
if(foo != nil)
{
[foo release];
foo = nil;
}
[super dealloc];
}