objective c - for a strong collection instance, is assign it to nil equals to release it and assign to nil? -


so have strong collection variable x (of type nsmutablearray e.g.), when doing dealloc, if x = nil, same effect following?

[x removeallobjects];  [x release]; // not needed in arc x = nil;  

strictly speaking, 2 not identical. setting strong variable nil indeed release object. however, array removeallobjects if getting destroyed. if variable holds strong reference array, stay alive , not remove items contains.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -