使用工具我在这个分离线程的方法中有内存泄漏:
-(void)goToThisUrl:(id) targetUrl
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (someCondition) {
// Doing some stuff here
}
// Instruments show memory leak on data
else {
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString: targetUrl]];
myTargetImage = [UIImage imageWithData:data];
// When releasing data(because data retainCount = 2), i got:
// Incorrect decrement of the reference count of an object that is not owned at this point by the caller
//[data release];
}
[pool release];
}
我不明白这个漏洞。
感谢。
答案 0 :(得分:1)
Kneejerk的可能性,因为该代码中没有内存所有权问题: