遍历我的核心数据对象时出现内存问题。当它循环通过 CFData(存储)时,它会不断增加,直到应用程序崩溃。每个循环完成后核心数据不应该释放内存吗?
for (Patient *patient in self.fetchedResultsController.fetchedObjects) {
for (Exam *examForPatient in patient.exams) {
//do stuff with examForPatient
}
}
编辑 - 尝试了以下但仍然表现相同:
for (Patient *patient in self.fetchedResultsController.fetchedObjects) {
for (Exam *examForPatient in patient.exams) {
NSLog(@"%@", [examForPatient.examDate description]);
[self.fetchedResultsController.managedObjectContext refreshObject:examForPatient mergeChanges:NO];
}
[self.fetchedResultsController.managedObjectContext refreshObject:patient mergeChanges:NO];
}