i.e. would cause the object to be released immediately and not have to be released by the pool if I did this?
[[NSArray arrayWithCapacity:100] release];
Can’t find a clear explanation in the docs about this.
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.
It would likely crash when the object would normally be autoreleased.
autoreleasemeans “delayed release”, so it will be released: just later. Since the object won’t exist later as you are manually releasing it, you will likely crash due to the runtime sending the-releasemessage to your now-deallocated object.Edit: Note that if you
-retainobjects that come autoreleased, you do have to-releasethem: you are taking ownership.