ios - Objective C: Query about releasing instance property -


i have general query regarding memory management

//in .h file defined property @interface aclass {     someclass *aproperty; }  @property (nonatomic, retain) someclass *aproperty;  end    //in .m file synthesized property , initialized property @implementation aclass  -(void)amethod {     self.aproperty = [[someclass alloc]init]; } 

my question

for 'aproperty', do 'release' prevent memory leak? understand instance properties (using dot notations), release in 'dealloc' , 'viewdidunload' methods. instance, need release aproperty again within method 'amethod'?

  1. you must release instance in dealloc
  2. your property initializations leaks memory. alloc+init, retain inside property, don't release. self.property = [[[someclass alloc] init] autorelease] used.

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -