【发布时间】:2011-11-26 01:06:22
【问题描述】:
如果我使用性能工具测试我的代码 - 泄漏,它不会检测到任何泄漏。这是否意味着代码没有泄漏任何内存?
我有一部越狱的 iPhone,我可以监控它的可用内存。如果有人知道,那就是 SBSettings。我测试了我的应用程序,它有一个 UITableView,当我滚动 tableView 时,我可以看到可用内存下降。从 300MB 到 30MB,似乎不能再下降了。它通常不会与游戏以外的其他应用程序一起下降太多。我正在使用带有 2 个按钮、1 个 textView 和 3 个 UILabel 的自定义 UITableViewCell。
所以,是的。如果性能工具没有检测到任何泄漏,我安全吗?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"StatusTableCell";
StatusTableCell *cell = (StatusTableCell *)
[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle]
loadNibNamed:@"StatusTableCell"
owner:nil options:nil];
for (id currentObjects in topLevelObjects){
if ([currentObjects isKindOfClass:[StatusTableCell class]]){
cell = (StatusTableCell *) currentObjects;
break;
}
}
[cell.cancelButton addTarget:self action:@selector(cancelButton:) forControlEvents:UIControlEventTouchUpInside];
}
/// some other stuff
return cell;
}
【问题讨论】: