Say I have:
@property (nonatomic,retain) NSString *foo;
in some class.
And I call:
myclass.foo = [NSString stringWithString:@"string1"]; myclass.foo = [NSString stringWithString:@"string2"];
Should I have called [myclass.foo release] before setting it to "string2" to avoid a memory leak?
Or the fact that nothing is pointing to the first "string1" object anymore is good enough?
And in the dealloc method [foo release] will be called.
[myclass.foo release]
. – Giao