Jon*_*lls 0 iphone memory-leaks objective-c ios
任何人都可以告诉我为什么这是方法给我泄漏?我一直在看它多年,无法弄清楚为什么它会泄漏.泄露的物体是ContactOperations.EventType是Malloc和Release.我以为init可能是错的?
联系控制器
ContactOperations *contactOps = [[ContactOperations alloc] initWithDatabase:database];
if ([contactOps applicationIsOwner])
[contactOps startOperations];
[contactOps release];
Run Code Online (Sandbox Code Playgroud)
仪器说,分配给我泄漏......
联系操作
ContactOperations
- (id)initWithDatabase:(Database*)aDatabase
{
if (self = [super init])
{
database = [aDatabase retain];
parameter = [[Parameter alloc] init];
parameter.database = aDatabase;
//addressBook = ABAddressBookCreate();
}
return(self);
}
-(void)dealloc
{
[database release];
[parameter release];
//CFRelease(addressBook);
}
Run Code Online (Sandbox Code Playgroud)
-(void)dealloc
{
[database release];
[parameter release];
//CFRelease(addressBook);
}
Run Code Online (Sandbox Code Playgroud)
你忘记[super dealloc];了最后- (void) dealloc.您必须调用[super dealloc]以清除ContactOperations的超类的实例变量.