问题
I receive a memory leak for the line containing the sortedArrayUsingSelector definition. Does anybody know what might be the problem?
@property (nonatomic, retain) NSArray *indexLetters;
...
NSMutableDictionary *indexedCategories = [[NSMutableDictionary alloc] init];
...
self.indexLetters = [[indexedCategories allKeys] sortedArrayUsingSelector:@selector(compare:)];
[indexedCategories release];
回答1:
It could be because you're not releasing the indexLetters
variable in dealloc
.
来源:https://stackoverflow.com/questions/6829741/nsarray-sortedarrayusingselector-memory-leak