gpt4 book ai didi

iphone - Obj-C,僵尸内存泄漏,我看不到?

转载 作者:行者123 更新时间:2023-11-29 04:52:42 24 4
gpt4 key购买 nike

我认为我有内存泄漏,我启用了僵尸并在探查器中突出显示了这部分代码,我标记了百分比。

我觉得不错。

有什么想法吗?

    [NSThread detachNewThreadSelector:@selector(threadStartAnimating:) 
toTarget:self withObject:nil];

NSMutableArray *tmpArray = [[NSMutableArray alloc]init];

if (metadata.isDirectory) {
for (DBMetadata *file in [metadata.contents reverseObjectEnumerator]) {
[tmpArray addObject:file.filename]; -- 44%
}
}

self.itemArray = tmpArray;
[tmpArray release];

[self.dropboxTableView reloadSections:[NSIndexSet indexSetWithIndex:0]
withRowAnimation:UITableViewRowAnimationFade]; -- 55.6%

[activityIndicator stopAnimating];

编辑

在界面中:-

NSMutableArray *itemArray;

最佳答案

我认为如果不使用 NSAutoreleasePool,线程会在这里产生泄漏?

-(void)threadStartAnimating
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//your code.
[pool release];
}

谢谢。

关于iphone - Obj-C,僵尸内存泄漏,我看不到?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8552772/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com