This is why you should use properties or explicit accessors.
If you have this:
@interface myObject : NSObject
{
NSMutableArray *classMembers;
}
@property(nonatomic, retain) NSMutableArray *classMembers;
@end
@implementation myObject
@synthesize classMembers;
-(id) init{
if (self=[super init]) {
self.classMembers=[[NSMutableArray alloc] initWithCapacity:1];
}
return self;
}
-(void) dealloc{
[classMembers release];
[super dealloc];
}
@end
You should not (and should never) skip around with the preservation of property. This eliminates all leaks and excessive release of properties.
, , , , .