In the documentation of NSData‘s initWithContentsOfURL:, it says:
The returned object might be different than the original receiver.
What are the implications of that? It seems to imply that a standard “alloc/init” line could leak memory.
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.
there are several reasons why – class clusters being the most publicly recognized:
no leaks are introduced using this form.
it just means that you should only use the result of the
alloc+initcall (rather than holding onto the result ofalloc), which is a good idea in any case — even when not explicitly documented.