【发布时间】:2011-06-17 16:51:41
【问题描述】:
我在 xcode4 中运行了仪器,它告诉我以下代码中有两个泄漏(由 **** 指出)。我以为我已经用 pt 的代码处理了内存释放。一个和pt。 B.
我在这里阅读了一些相关主题,但仍然无法弄清楚为什么以及如何解决它们。
另一个问题是是否在 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
}
提前非常感谢! 陆
【问题讨论】:
标签: ios memory-leaks