Do I have to call release in the dealloc method of a class for non-pointer variables?
e.g.
@interface myClass : NSObject {
BOOL isDirty; // do i have to release this?
NSInteger hoursSinceStart; // and this?
NSDate *myDate; // i will release the pointer in dealloc
}
@property (assign, nonatomic) NSInteger hoursSinceStart; // property to release?
@property (assign, nonatomic) BOOL isDirty; // property to release?
@end
Two things:
You only need to retain and release objects. BOOLs and NSIntegers are not objects, they’re primitives.
You generally shouldn’t call
releasefor anyassignproperty, because you haven’t retained it — and of courseassignis the only type that makes sense for primitives like NSIntegers or BOOLs, since you can’t retain them in the first place.