J'ai ce code pour charger un ensemble de propriétés à partir du fichier, puis l'affecter.NSKeyedUnarchiver Memory Leak
NSMutableData* data = [NSData dataWithContentsOfFile:fullPath];
NSKeyedUnarchiver* unarc = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
NSMutableArray* loadedLibraries = [unarc decodeObjectForKey:@"libraries"];
IRStudyPlan* loadedStudyPlan = [unarc decodeObjectForKey:@"currentStudyPlan"];
NSMutableDictionary* loadedWordLists = [unarc decodeObjectForKey:@"wordLists"];
NSMutableDictionary* loadedStudyPlanList = [unarc decodeObjectForKey:@"studyPlanList"];
[unarc finishDecoding];
[self setLibraries:loadedLibraries];
[self setStudyPlanList:loadedStudyPlanList];
[self setCurrentStudyPlan:loadedStudyPlan];
[self setWordLists:loadedWordLists];
[unarc release];
Je me demande pourquoi j'ai une fuite de mémoire sur chaque objet. Mon initWithCoder est celui-ci, comme pour tous les objets:
-(id)initWithCoder:(NSCoder *)decoder{
if([super init]!=nil){
[self setListName:[decoder decodeObjectForKey:@"listName"]];
[self setWordsWithStatistics:[decoder decodeObjectForKey:@"wordsWithStatistics"]];
[self setWordsWithStatisticsInGame:[decoder decodeObjectForKey:@"wordsWithStatisticsInGame"]];
}
return self;
}
Quelqu'un peut-il me éclairer?
Merci beaucoup