Re: CoreData, reset a persistent store
Re: CoreData, reset a persistent store
- Subject: Re: CoreData, reset a persistent store
- From: "Marcus S. Zarra" <email@hidden>
- Date: Wed, 15 Nov 2006 10:24:56 -0700
Have you tested doing a full retrieval and deletion? When core data
retrieves the objects, they are in a faulted state. As long as you
do not touch any of the fields inside of the objects they will remain
faulted and take up a minimal amount of memory.
As others have suggested, you might be prematurely optimizing this
issue. I would suggest trying a retrieval/delete and test it with
shark to see if there is even a memory issue to solve.
Marcus S. Zarra
Zarra Studios LLC
Simply Elegant Software for OS X
www.zarrastudios.com
On Nov 15, 2006, at 9:47 AM, Elise van Looij wrote:
Op 14-nov-2006, om 17:20 heeft Pierre Chatelier het volgende
geschreven:
No, at runtime I don't think that would be a good idea. You might
want to take a look at Apple's NSPersistentStoreCoordinator Class
Reference.
That's what I did, but there is no method to clear a persistent
store.
But as far as the cache growing to gigantic proportions, I don't
think you need to worry about that.
I do worry. I don't want my cache file to take dozen of GB, even
if only a part of it is in memory (thanks to faulting).
So far, what I do is:
-lock the managed object context
-reset the managed object context to clear all pending changes
-call removePersistentStore:error on the PersistentStoreCoordinator
-remove the underlying file with NSFileManager
-call addPersistentStoreWithType:configuration:URL:options:error
on the PersistentStoreCoordinator to re-create the file
-unlock the managed object context
Sorry, I don't know enough about memory management to help you with
that. What I don't quite understand from your solution, though, is
why you want to discard all the pending changes. If you don't want
to have any pending changes, don't allow your users to make any
changes. That way you won't have to worry about throwing them away.
Elise van Looij
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden