我加載了很多來自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) –