NSString* str = @"foo";
str = [NSString stringWithFormat:@"%@%@", str, @"bar"];
Will @”foo” be autoreleased? That is, will its retain count go to 0 when str is reassigned?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it will be released. You didn’t alloc/init/new/copy it.
Edit: I suppose it would be more correct to say “no, it won’t leak”, since it is in fact a constant. The alloc/init/new/copy advice still applies though.