我在xcode中使用了分析功能,并且我已经修复了除此之外的所有内容。不明白潜在的泄漏
我想知道这是什么意思“潜在的泄漏对象分配”,它是指这些行。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.type_prod = [[ProductType alloc] initWithNibName:@"ProductType" bundle:[NSBundle mainBundle]];
NSString *prodtitle = [product objectAtIndex:indexPath.row];
type_prod.prodtitle = prodtitle;
etc etc.
在这一空白结束时,我说:
[[self navigationController] pushViewController:type_prod animated:YES];
[type_prod release];
那么,为什么它说有一个潜在的泄漏,如果我在最后释放呢?
[ProductType页头] = 1保留计数 self.type_prod + 1 [type_prod发布] - 1 – VenoMKO 2012-07-13 17:49:05
我明白我的保留数为1,因为我的Alloc,但由于我释放它,它会是1-1 = 0(至少这是我的想法)。但事实证明,self.type_prod增加其保留计数+1? – Prastow 2012-07-14 15:35:45
我想你的保留数是2 self.type_prod最有可能使用保留。 – VenoMKO 2012-07-14 15:38:53