对于非指针变量,我必须在类的dealloc
方法中调用release
吗?必须在dealloc中释放非指针实例变量吗?
例如
@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
不,这些值将保留在堆栈中,并在程序调用dealloc方法时弹出。 – fatih 2011-06-15 19:52:11
@faith我怀疑dealloc与堆栈变量有什么关系? – Tatvamasi 2011-06-15 20:04:07