Re: CoreData huge memory usage - is this right ?
Re: CoreData huge memory usage - is this right ?
- Subject: Re: CoreData huge memory usage - is this right ?
- From: email@hidden
- Date: Fri, 14 Dec 2007 06:57:06 -0800
On Friday, December 14, 2007, at 12:39PM, "Martin Linklater" <email@hidden> wrote:
>Hi - I'm in the process of writing code which will create and populate a CoreData SQLite store. I have a few million objects to deal with. I have written code which imports a text description of my data and then iterates through inserting and setting attributes of my CoreData objects. Things are going fine with the exception of one problem I am having... I am seeing CoreData take huge amounts of RAM to do it's thing. When my SQLite store is at around 10MB in size, my task is taking upwards of 500+MB of memory.
Hmm, do you have a lot of relationships ? Many to many relationships with inverses eats a lot of memory, because both collections are fetched in a simple addObject =/
[ ... snip ... ]
>This code is executing fine, and my elements are indeed being inserted into the CoreData store because I have ran this code with an XML store and things are being stored fine. Saving of the moc is returning with no errors too.
>
>So I am stumped as to why CoreData is allocating an awful lot of memory for this task... can anyone shed some light on what I'm doing wrong
You can check the [NSManagedObjectContext setStalenessInterval:] documentation, disable the undoManager, read the http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdMemory.html#//apple_ref/doc/uid/TP40001860 and use a NSAutoreleasePool, even under GC (remember to use drain instead of release).
:: marcelo.alves
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden