iphone - About memory management (spec for object create by Interface builder) -
i have question on free object memory in object c .
for example code :
@interface mycell : uitableviewcell { iboutlet uiview* bindview; iboutlet uiview* unbindview; }
as see, 2 object , first assign , bind via interface builder , no
in dealloc code , try free avoid memory leak . follow:
- (void)dealloc { [bindview release]; bindview = nil; [unbindview release]; unbindview = nil; [super dealloc]; }
so, think free all..... code execute , strange because second object unbindview
never assign in code or ib, seem should nil, code still can executed no nil pointer exception throws ....
my question, whether free object code above right , best way ? because bindview
never been retained , think should handle cocoa ? next question unbindview
, know object weak language, rule type variable usage ?
thanks answers !
because second object
unbindview
never assign in code or ib, seem should nil, code still can executed no nil pointer exception throws ....
in objective-c, sending messages nil
results in nothing happening. that's why don't exceptions. on 1 hand it's convenient; on other hand, can pretty hard track down, , it's not expected in cases.
my question, whether free object code above right , best way ?
i think it's fine. = nil
lines aren't necessary since view controller have been deallocated @ time called, don't think should negatively affect app's code.
Comments
Post a Comment