I have a general query regarding memory management
//In .h file I defined a property
@interface AClass
{
someClass *aProperty;
}
@property (nonatomic, retain) someClass *aProperty;
end
//In .m file I synthesized the property and also initialized the property
@implementation AClass
-(void)aMethod
{
self.aProperty = [[someClass alloc]init];
}
My question is
For ‘aProperty’, where do I do a ‘release’ to prevent a memory leak? I understand normally for instance properties (using dot notations), we do a release in the ‘dealloc’ and ‘viewdidunload’ methods. But for this instance, do I need to release aProperty again within the method ‘aMethod’?
self.property = [[[someClass alloc] init] autorelease]is usually used.