讨厌的NSPropertyListSerialization泄漏 [英] Nasty NSPropertyListSerialization Leak
问题描述
NSString *anError = nil;
id plist;
plist = [NSPropertyListSerialization propertyListFromData:rawCourseArray mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&anError];
if (anError != nil){
[anError release];
}
上面的代码每次调用都会导致内存泄漏.我正在释放错误,但仍然存在泄漏.我没有看到任何解决此问题的方法.我已经张贴了这个,大多数人回答这不是泄漏.但是请参见泄漏性能工具中的此处:
The above code causes a memory leak every time I call it. I am releasing the error but still there is a leak. I haven't seen any resolution to this issue. I posted this already and most respond that this is not a leak. But see here in the leak performance tool:
我需要修复此问题,因为最终我的应用程序崩溃了.有任何想法吗?非常感谢
I need this fixed because eventually my app crashes. Any ideas? Many thanks
推荐答案
我遇到了同样的问题.使用的propertyListWithData:options:format:error:具有相同的结果.使用NSDictionary initWithContentsOfFile具有相同结果:
I had the same problem. Used propertyListWithData:options:format:error: with same result. Used NSDictionary initWithContentsOfFile with same result:
泄漏的对象#地址大小负责的图书馆负责的框架 NSCFNumber,19<多个> 304字节的MediaToolbox FigRemote_CreatePropertyListFromBinaryPListData
Leaked Object # Address Size Responsible Library Responsible Frame NSCFNumber,19 < multiple > 304 Bytes MediaToolbox FigRemote_CreatePropertyListFromBinaryPListData
FWIW-我在pList中只有字典,数组和字符串,没有数字.
FWIW - I only have dictionaries and arrays and strings in the pList, no numbers.
问题不是错误对象(或方法中的字符串).上面的问题不是plist的问题,因为它应该是自动发布的.最后,我放弃了,并使用JSON和重新实现:
The issue is not the error object (or string in your method). The issue is not plist above, since it should be autorelease. In the end, I gave up and reimplemented using JSON and:
http://stig.github.com/json-framework/api/index.html
==>不再泄漏.
最好, 弗雷德
这篇关于讨厌的NSPropertyListSerialization泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!