Hi. I have a simple example of what I don't understand about memory management on the iPhone:
- (IBAction)AssignAndReleaseOne :(id)sender {
for (int i=0;i<10;i++) {
someString = [[NSString alloc] initWithString:@"String Assigned"];
}
[someString release];
}
- (IBAction)AssignAndReleaseTen :(id)sender {
for (int i=0;i<10;i++) {
someString = [[NSString alloc] initWithString:@"String Assigned"];
[someString release];
}
}
I would expect to get a memory leak in the first method because I alloc 10 times (or is it 11 :) with only one release, but Instruments doesn't report any errors?
Am I or is Instruments correct?
Thanks Chris.