objective c - CoreData - Refreshing an object doesn't change registeredObjects count -
I want to clear some of the memory that releases unused managed objects from context.
I prefer not to use Now, if I enter To help you understand just about the example, this model is a simple description: With a reminder a specific task list Therefore, there are work items and alarm objects related to those tasks. There may be more than one alarm in any work And here is the code, which generates this problem: Since I am looking for detail in 1) After the call, the count of registered objects does not change < Code> refresh object 2) Is this a good practice? Or should I go with the reset, avoiding leaving single objects? Why not count the registered objects after calling the referring object Because you are not removing it, you are turning the object to error (hence its information is removed from memory but not disc). Is this good practice? Or with reset, should I go to avoid leaving single items? Resets the in-memory presentation of all the objects in the context - you generally do not want to do this, the refreshing object considers valid, is just one mistake, refreshing means that You must drop all references to any object in that context because they are invalid and can not be used again (you have to refresh them). Generally, refreshing is a good way, but only if you need to keep the context of the object and the object description is not often needed if you do not need an object, Instead it should be left. reset and I want to release single objects using this function:
[self .managedObjectContext refreshObject: alarm mergeChanges: no];
registered object count after this code, then nothing seems to have changed. I still get the same number of items that I have before the call.
alarm * alarm = [NSTTAscription Includes New ObjectForternName : Managed object contexts in ENTITY_ALARM: self Management object contexts]; Self.task.alarm = [NSSet set with object: alarm]; [Self saving] [self. Managed Object Contex Refresh Object: Alarm Merge Changes: No];
Task , I'm not interested in keeping the
alarm object in memory.
My questions are:
Comments
Post a Comment