I'm reading memory management rules to this point where it said
- (void)printHello {
NSString *string;
string = [[NSString alloc] initWithString:@"Hello"];
NSLog(@"%@", string);
[string release];
}
you have ownership and have to release string
, but I'm curious about the @"Hello"
. @" "
is the syntax for creating and NSString
, and it's an object. So doesn't that get leaked?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…