Hello,
since every assignment to a variable with a different object increases its retain count and in the dealloc its not always clear how often a variable got assigned a simple [maVar release] might NOT BE SUFFICIENT. So using ALWAYS myVar = nil
sets the retain count to zero, and a subsequent [myVar release]
will never cause a problem again. (is it actually still required ?)
The only situation when not to do it this way is if myVar is passed OUT then I must not do this, since the value gets destroyed by myVar = nil
;
Is my thinking correct? Or could this way of avoiding leaks cause any other problems?
Thanks!