HI,
I am working on optimizing my iphone project for proper memory management.
my question is:
what’s the difference between releasing an object inside dealloc or releasing in the same method where we init it?
Thanks!
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.
Generally, you want to release an object as close to the point in the code where you initialize it as possible. If you have local variables in a method that you are
init-ing, you release them before the method returns.This, however, is not possible with instance variables, since they stick around with the objects; thus, you release them in a
deallocmethod.