1

I am calling [array addObjectsFromArray:dictionary.allValues] Will each copied object have retain count incremented for it? My understanding that when I do [array addObject:obj] , it will retain obj for me untill I delete obj from array or release array itself. Was wondering if its the same with addObjectsFromArray

Thanks.

2 Answers 2

1

refer this :

NSMutableArray memory management

Regarding the object creation methods, all of the convenience methods (array:, arrayWithObjects:, arrayWithArray:, etc.) return autoreleased objects. However, their corresponding init methods (init:, initWithObjects:, initWithArray:, etc.) do not - if you call them, you are responsible for calling release on the returned object

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

Comments

0

function that begin with init,copy,add etc always increments the retain counter of the corresponding object.If you are done with and object you should release it adterr adding to an nsmutablearray

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.