NSArray sortedArrayUsingSelector memory leak

夙愿已清 提交于 2020-01-24 14:02:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!