以下循环中似乎存在一些内存泄漏:
NSMutableArray *array1 = [[NSMutableArray alloc] init];
for(SomeClass *someObject in array2){ //has already been populated;
if (someObject.field == desiredValue){
[array1 addObject:someObject];
}
}
//EDIT:
//use array1 for very secret operations
[array1 release];
任何想法为什么?
答案 0 :(得分:1)
您是否在您的SomeClass中发布了所有保留的属性?确保在dealloc中释放所有保留的属性。确保你的SomeClass没有泄漏..