• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!


  • Subject: Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!
  • From: Jim Correia <email@hidden>
  • Date: Mon, 11 Dec 2006 08:43:22 -0500

On Dec 11, 2006, at 3:08 AM, Aurélien Hugelé wrote:

I'm not sure, but i think saving the context has the very same effect as processPendingChanges.
Anyway it is not sufficient.

Saving the context should cause all pending changes to be processed. The object is deallocated on the *next* (different pass through the event loop) process pending changes (which never happens in your app, but would happen in a GUI app where the user was making edits.)


I can't offer you an explanation for why this is true, only that it appears to be true on 10.4.8.

Here are the modifications I made to your sample:

- (void)applicationDidFinishLaunching:(NSNotification *)sender {
// insert a managed object (autoreleased)
NSManagedObject* truc = [NSEntityDescription insertNewObjectForEntityForName:@"Entity" inManagedObjectContext: [self managedObjectContext]];
// modify it
[truc setValue:@"toto" forKey:@"attribute"];
// save so that it is not inserted anymore
[[self managedObjectContext] save:nil];

[self performSelector: @selector (clearUndoStackAndProcessPendingChanges) withObject: nil afterDelay: 0];
}


- (void)clearUndoStackAndProcessPendingChanges {
	[[[self managedObjectContext] undoManager] removeAllActions];
	[[self managedObjectContext] processPendingChanges];
}

Jim_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!
      • From: Aurélien Hugelé <email@hidden>
References: 
 >Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... (From: Scott Stevenson <email@hidden>)
 >Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!! (From: Aurélien Hugelé <email@hidden>)
 >Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!! (From: Melissa Turner <email@hidden>)
 >Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!! (From: Aurélien Hugelé <email@hidden>)
 >Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!! (From: Jim Correia <email@hidden>)
 >Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!! (From: Aurélien Hugelé <email@hidden>)

  • Prev by Date: ilife media browser
  • Next by Date: NSAttributedString question
  • Previous by thread: Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!
  • Next by thread: Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!
  • Index(es):
    • Date
    • Thread