我加载了很多来自plist的注释,所有加载都很好,但是如果我从NSCachesDirectory加载内存泄漏工具显示泄漏。如果我从url加载,没有泄漏。我在项目中使用ARC。如果从NSCachesDirectory加载内存泄漏
内存泄露
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *path = [[documentPaths lastObject] stringByAppendingPathComponent:@"test.plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path]; // leaking here
无漏
NSString *urlStr = [[NSString alloc]
initWithFormat:@"http://www.domain.com/test.plist" ];
NSURL *url = [NSURL URLWithString:urlStr];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfURL:url];
其实,我现在看到你已经问这个问题,那个人实际上有更多的数据。请不要只是重新提出一个问题,尤其是在背景/信息少得多的情况下。 –
可能重复[内存泄漏在新线程使用弧](http://stackoverflow.com/questions/12653016/memory-leak-on-new-thread-using-arc) –