【发布时间】:2011-04-19 00:05:20
【问题描述】:
谁能解释一下为什么使用 mutableCopy 会导致内存泄漏?
- (id)objectInListAtIndex:(unsigned)theIndex {
NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"noteNumber" ascending:YES] autorelease];
[list sortUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];
NSMutableArray *theArray = [list mutableCopy];
NSDictionary *theDict = [theArray objectAtIndex:theIndex];
return theDict;
}
【问题讨论】:
标签: objective-c memory-leaks nsmutablearray