[英]Objective-C Leak
誰能告訴我為什么這是給我泄漏的方法? 我已經看了很久了,無法弄清楚它為什么泄漏。 泄漏的對象是ContactOperations
。 EventType是Malloc和Release。 我以為init
可能是錯誤的?
接觸控制器
ContactOperations *contactOps = [[ContactOperations alloc] initWithDatabase:database];
if ([contactOps applicationIsOwner])
[contactOps startOperations];
[contactOps release];
儀器說分配給我泄漏...
聯系運營
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);
}
-(void)dealloc
{
[database release];
[parameter release];
//CFRelease(addressBook);
}
您忘記了[super dealloc];
在- (void) dealloc
的末尾。 您必須調用[super dealloc]
才能清除ContactOperations的超類的實例變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.