On Dec 22, 2008, at 12:17 AM, Jerry Krinock wrote:

REAL-LIFE PROBLEM

In a managed memory application, I have a managed object which, besides its Core Data managed properties, has a single instance variable, a worker-kind of object which does some heavy lifting for it. So that this retained worker, etc., will be deallocced, I need this managed object to get deallocced when no longer needed.

The documentation [1] seems very clear that, although the 'insert...' methods return an autoreleased NSManagedObject, a managed object may be retained by:
  (a) the managed object context, until changes are saved
         or rolled back, or,
  (b) the managed object context's undo manager, as long as
         an action involving the managed object remains on
         the undo stack.

The documentation is also clear that Core Data "reserves exclusive control over the life cycle of the managed object".

Absent a really good reason not to, you probably should release (and nullify the iVar) the worker-kind object when you are turned into a fault (-didTurnIntoFault.)

If you do this, does it solve your problem?

Jim
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to