Skip navigation.
 
mlRe: CoreData retain/release/delete
FROM : John Brownlow
DATE : Fri Apr 29 21:49:31 2005

That almost answers my question.

But I am concerned about managedObjects whose retain count falls to
zero, but which are *not* explicitly deleted using -deleteObject.

Are these automatically deleted from the persistent store on save, or
do they hang around?

I create a lot of objects with many relationships which I do not want
to track manually. Once they are released from all relationships and
their retain count falls to zero, I want them to be deleted from the
persistent store since I have no further use for them.

An example of this might be a 'sequence' object, which is an ordered
collection of 'scene' objects. Once a sequence has lost all of its
scenes and has been removed from any parent sequences, its retain-count
will be zero and I would like it to be removed from the persistent
store on the next save, since I may create and dispose of hundreds of
these objects in the course of writing a screenplay over many weeks.

I don't want to have to track this manually, so I'm trying to find out
how exactly it works.



On Apr 29, 2005, at 3:07 PM, Scott Stevenson wrote:

>> When the MOC saves, is the persistent store overwritten, and the
>> object effectively deleted from the saved file, or does it hang
>> around and have to be deleted manually using the -deleteObject
>> method?

>
> You only have to delete it once, then save. Does that answer the
> question?
>
> A Managed Object could also be deleted indirectly if it's at the
> destination end of a relationship which is set to "cascade", and the
> owner of the relationship is deleted.

--
John Brownlow
Deep Fried Films, Inc

http://www.johnbrownlow.com
http://www.pinkheadedbug.com

Related mailsAuthorDate
mlCoreData retain/release/delete John Brownlow Apr 29, 20:53
mlRe: CoreData retain/release/delete Scott Stevenson Apr 29, 21:07
mlRe: CoreData retain/release/delete John Brownlow Apr 29, 21:49
mlRe: CoreData retain/release/delete Scott Stevenson Apr 29, 22:03
mlRe: CoreData retain/release/delete John Brownlow Apr 29, 22:22
mlRe: CoreData retain/release/delete Scott Stevenson Apr 29, 22:29
mlRe: CoreData retain/release/delete Bill Bumgarner Apr 29, 23:46
mlRe: CoreData retain/release/delete Johnny Deadman Apr 30, 02:02
mlRe: CoreData retain/release/delete Scott Stevenson Apr 30, 02:09
mlRe: CoreData retain/release/delete mmalcolm crawford Apr 30, 02:10
mlRe: CoreData retain/release/delete Johnny Deadman Apr 30, 02:16
mlRe: CoreData retain/release/delete Shawn Erickson Apr 30, 02:21
mlRe: CoreData retain/release/delete mmalcolm crawford Apr 30, 02:23
mlRe: CoreData retain/release/delete Shawn Erickson Apr 30, 02:32