I am wondering, does local variable need to set to nil to deallocate the variable after use?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. The memory is deallocated based on its retain count. Once that goes to zero it will be deallocated regardless of the value of the variable that used to point to it. Setting a variable to nil is a good practice so you don’t try to access deallocated memory.