three20 TTTableSubtitleItem内存泄漏?

时间:2011-06-22 11:13:38

标签: iphone xcode memory-leaks three20

我创建了一个TTTableSubtitleItem将它添加到一个数组中,将表数据源设置为数组然后释放数组但是泄漏在TTTableSubtitleItem上显示泄漏我不知道为什么?

NSMutableArray *ar =  [[NSMutableArray alloc] init];
while (item = (NSDictionary*)[enumerator nextObject]) {
    NSString *result = [NSString stringWithFormat:@"tt://VideoListViewController/%@",
                        [item objectForKey:@"id"]];

    [ar addObject:[TTTableSubtitleItem itemWithText:[item objectForKey:@"name"]
                                           subtitle:[item objectForKey:@"description"]
                                                URL:result]];   

}
self.dataSource = [[myDataSource alloc] initWithItems:ar];
[ar release];

1 个答案:

答案 0 :(得分:0)

您的泄漏位于:

self.dataSource = [[myDataSource alloc] initWithItems:ar];

将其更改为:

self.dataSource = [[[myDataSource alloc] initWithItems:ar] autorelease];

您已分配myDataSource但未释放它。另外,你能在.h文件中向我展示你的'dataSource'声明吗?