When you alloc
have something, you are already the owner, so there is no need for retain
it.
Look here for the full story.
Your method (and class) is actually poorly written with regards to memory management. You should:
, :
- (void) method1 {
[list release];
list = [[NSMutableArray alloc] init];
NSString *f = [[NSString alloc] initWithCString: "f"];
[list addObject: f];
[f release];
}
- (void) dealloc {
[list release];
[super dealloc];
}