【发布时间】:2011-10-09 09:06:24
【问题描述】:
我是 Objective c 的新手,我不明白这里是如何出现内存泄漏的:
MessageCustomCell *cell = [[MessageCustomCell alloc] initAutoreleaseWithLine:currentLine AndId:message.UID];
[[cell dateTime] setText:[formatter stringFromDate:message.Date]];
[[cell from] setText:message.From];
[[cell play] setTitle:@">" forState:UIControlStateNormal];
[formatter release];
return cell;
在返回单元格上;行分析器说存在“在第 207 行分配并存储到单元格中的对象的潜在泄漏”。这是分配单元格的行,但我要返回单元格,所以这是怎么泄漏的? 提前感谢您的帮助!
【问题讨论】:
-
initAutoreleaseWithLine:方法看起来如何? -
使用 autorelease 怎么样?检查我的答案 [这里][1]。 [1]:stackoverflow.com/questions/4930182/…
标签: objective-c xcode memory-leaks