I have a multithreaded application using core data. Each thread has it's own ManagedObjectContext as recommended. There is a NSManagedObject which, in addition to a few other attributes, has an object which is stored as binary data and unpacked into a transient attribute when needed. Some data is either gathered or generated from this object (typically an NSString) and then passed to the main thread for display in the UI.

Here is the weird part. Even if I retain/copy the NSString, it becomes invalid (deallocated) when the NSManagedObject it came from turns into a fault. This happens even with onjects that are retained by other objects and should be around for the lifetime of the program. Keep in mind that this string is not an attribute of the managed object, but is only generated from an object that is stored as an attribute. I am following standard memory management practices (e.g. I have checked to make sure I am calling -release and not - dealloc in the dealloc method, and the string is being retained in the initWithCoder: method).

Luckily, this only happens when the NSString crosses the thread boundary, so that should be a clue as to why it is happening... though I am not sure what that reason is.

I am definitely missing something here. Any idea what might be happening?

Thanks,
Jon
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to