• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData huge memory usage - is this right ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData huge memory usage - is this right ?


  • Subject: Re: CoreData huge memory usage - is this right ?
  • From: Martin Linklater <email@hidden>
  • Date: Tue, 18 Dec 2007 10:57:19 +0000

Perhaps if you'd post your import routine?

Of course... Here are the relevant parts of my code:

Main Controller:
{
NSManagedObjectContext *moc = [appDelegate managedObjectContext];

[moc setStalenessInterval:0.1];
[[moc undoManager] disableUndoRegistration];

[importer importFile:@"AgtOfferDetails.sql" usingEntity:@"AgtOfferDetails" andFlags:0];
lots more import calls (around 100) etc.


	[[moc undoManager] enableUndoRegistration];
}

Import routine:

- (void)importFile:(NSString*)file usingEntity:(NSString*)entity andFlags:(int)flagsIn;
{
int entryNum = 0;

NSAutoreleasePool* subPool = [[NSAutoreleasePool alloc] init];


while( thisEntry = [filePartsEnum nextObject] )
{
entryNum++;

id coreDataElement = [NSEntityDescription insertNewObjectForEntityForName:entity inManagedObjectContext:[self moc]];


// set attributes
[coreDataElement setValue:[NSNumber numberWithInt:[valueString intValue]] forKey:keyString];
..etc...

if( ( entryNum % 1000 ) == 0)
[subPool drain];
}
}


 	BOOL ret = [moc save:&error];

	if( ret == NO )
	{
		CPSLogInfo( thisEntry );
		[[NSApplication sharedApplication] presentError:error];
	}	

	[subPool release];
}


Sorry for the delay - .Mac was evperiencing problems yesterday ad I was unable to receive or send email.


Thanks.
_______________________________________________

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


  • Follow-Ups:
    • Re: CoreData huge memory usage - is this right ?
      • From: Mike Abdullah <email@hidden>
References: 
 >CoreData huge memory usage - is this right ? (From: Martin Linklater <email@hidden>)
 >Re: CoreData huge memory usage - is this right ? (From: email@hidden)
 >Re: CoreData huge memory usage - is this right ? (From: "I. Savant" <email@hidden>)
 >Re: CoreData huge memory usage - is this right ? (From: Martin Linklater <email@hidden>)
 >Re: CoreData huge memory usage - is this right ? (From: email@hidden)
 >Re: CoreData huge memory usage - is this right ? (From: Martin Linklater <email@hidden>)
 >Re: CoreData huge memory usage - is this right ? (From: Martin Linklater <email@hidden>)
 >Re: CoreData huge memory usage - is this right ? (From: Martin Linklater <email@hidden>)
 >Re: CoreData huge memory usage - is this right ? (From: "I. Savant" <email@hidden>)

  • Prev by Date: SSL support on Webkit
  • Next by Date: Re: CoreData huge memory usage - is this right ?
  • Previous by thread: Re: CoreData huge memory usage - is this right ?
  • Next by thread: Re: CoreData huge memory usage - is this right ?
  • Index(es):
    • Date
    • Thread