관계에서 엔터티에 액세스 할 때 이상한 (나에게) 메모리 누수가 있습니다.핵심 데이터 관계 메모리 누수
시리즈와 타일은 서로 반대의 관계가 있습니다.
// set up the fetch request
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Series" inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:entity];
// grab all of the series in the core data store
NSError *error = nil;
availableSeries = [[NSArray alloc] initWithArray:[managedObjectContext executeFetchRequest:fetchRequest error:&error]];
[fetchRequest release];
// grab one of the series
Series *currentSeries = [availableSeries objectAtIndex:1];
// load all of the tiles attached to the series through the relationship
NSArray *myTiles = [currentSeries.tile allObjects]; // 16 byte leak here!
인스트루먼트는 최종 줄의 NSPlaceHolderString에 의한 16 바이트 누수 원인을 다시보고합니다.
스택 추적 :
2 UIKit UIApplicationMain
3 UIKit -[UIApplication _run]
4 CoreFoundation CFRunLoopRunInMode
5 CoreFoundation CFRunLoopRunSpecific
6 GraphicsServices PurpleEventCallback
7 UIKit _UIApplicationHandleEvent
8 UIKit -[UIApplication sendEvent:]
9 UIKit -[UIApplication handleEvent:withNewEvent:]
10 UIKit -[UIApplication _runWithURL:sourceBundleID:]
11 UIKit -[UIApplication _performInitializationWithURL:sourceBundleID:]
12 Memory -[AppDelegate_Phone application:didFinishLaunchingWithOptions:] /Users/cfish/svnrepo/Memory/src/Memory/iPhone/AppDelegate_Phone.m:49
13 UIKit -[UIViewController view]
14 Memory -[HomeScreenController_Phone viewDidLoad] /Users/cfish/svnrepo/Memory/src/Memory/iPhone/HomeScreenController_Phone.m:58
15 CoreData -[_NSFaultingMutableSet allObjects]
16 CoreData -[_NSFaultingMutableSet willRead]
17 CoreData -[NSFaultHandler retainedFulfillAggregateFaultForObject:andRelationship:withContext:]
18 CoreData -[NSSQLCore retainedRelationshipDataWithSourceID:forRelationship:withContext:]
19 CoreData -[NSSQLCore newFetchedPKsForSourceID:andRelationship:]
20 CoreData -[NSSQLCore rawSQLTextForToManyFaultStatement:stripBindVariables:swapEKPK:]
21 Foundation +[NSString stringWithFormat:]
22 Foundation -[NSPlaceholderString initWithFormat:locale:arguments:]
23 CoreFoundation _CFStringCreateWithFormatAndArgumentsAux
24 CoreFoundation _CFStringAppendFormatAndArgumentsAux
25 Foundation _NSDescriptionWithLocaleFunc
26 CoreFoundation -[NSObject respondsToSelector:]
27 libobjc.A.dylib class_respondsToSelector
28 libobjc.A.dylib lookUpMethod
29 libobjc.A.dylib _cache_addForwardEntry
30 libobjc.A.dylib _malloc_internal
는 내가 분명 뭔가가 있다고 생각하지만 난 꽤 무엇을 알아낼 수 없습니다.
도움 주셔서 감사합니다.
업데이트 : 문제의 코드 조각을 applicationDidFinishLaunching의 첫 번째 부분에 복사했는데 여전히 누출됩니다. 내 모델에 문제가있을 수 있습니까?
흥미 롭습니다! 나는 아직도 내가 뭘하고 있는지에 대해 끔찍한 잘못을 보지 않는다. 그래서 나는 이것으로 갈 것이다. 도와 주셔서 정말로 고맙습니다! – cfihelp