What is the difference between setting object = nil and [object release] VS [object release] and object = nil?
问题 What is the difference between these two code snippets: object = nil; [object release] Vs [object release]; object = nil; which is the best practice ? 回答1: object = nil; [object release] Don't do that. You are sending a release message on a nil object that will just do nothing. But the object that was referenced by your object is still in memory because it has never received a release message. [object release]; object = nil; Here you release the object, and for convenience and security, you