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 07:25:21 -0800
[ .... snip ....]
>This doesn't seem to work... The memory usage isn't affected at all. My code now looks like this:
Use a low value (but greater than zero) in setStalenessInterval and disable the UndoManager, before the loop. Your MOC has a reference to every object created.
>
>import()
>{
>NSAutoreleasePool* subPool = [[NSAutoreleasePool alloc] init];
>
>while( not end of file )
>{
> id coreDataElement = [NSEntityDescription insertNewObjectForEntityForName:name in ManagedObjectContext:moc];
>
> // add my attributes for the element
> [coreDataElement setValue:value forKey:key];
> [coreDataElement setValue:value forKey:key];
> [coreDataElement setValue:value forKey:key];
> etc.
>
> [coreDataElement release];
>
> // then every 1000 entries or so I am saving the context
> {
> [moc save:&error];
> [subPool drain];
> }
>
>}
>
>[subPool drain];
>
>return;
>}
_______________________________________________
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