0

Is there a difference between [NSMutableArray array] and [[NSMutableArray alloc] init] ?

1 Answer 1

4

[[NSMutableArray alloc] init] returns a mutable array that you own (and therefore have to explicitly relinquish ownership using release when you no longer need it) and [NSMutableArray array] returns a mutable array that you don't own.

According to the Memory Management Rules, any method with the word alloc, new, or create in the name, implies that you own the object returned from that method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.