我在xcode4中运行仪器,它告诉我在下面的代码中有两处泄漏(由****
记录)。我以为我在代码处理了内存释放的问题。 A和pt。 B.如何解决pushViewController周围的内存泄漏问题?
我在这里通读了一些相关的主题,但仍然无法弄清楚为什么以及如何解决它们。
另一个问题是,是否在pt发布。 A是必要的。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Get the dialog id
NSDictionary *rowData = [dialogs objectAtIndex:indexPath.row];
NSInteger dialogId = [[rowData objectForKey:@"id"] intValue];
DialogViewController *detailViewController = [[DialogViewController alloc] initWithNibName:@"DialogViewController" bundle:nil];
detailViewController.dialogId = dialogId;
NSString *title = [NSString stringWithFormat:@"%d. %@", [[rowData objectForKey:@"id"] intValue], [rowData objectForKey:@"title"]];
****** i 6.8%
[detailViewController.dialogTitle release]; // pt. A
detailViewController.dialogTitle = [title retain];
[self.navigationController pushViewController:detailViewController animated:YES];
****** i 93.2%
[detailViewController release]; // pt. B
}
非常感谢! 鲁
rekle,谢谢你的回答!那么你知道为什么Xcode4的泄漏工具将pt.B标记为泄漏吗?我应该把它作为一个假阴性还是有可能是DialogViewController泄漏?你会建议什么? –