Core Data memory not freed after reset
Core Data memory not freed after reset
- Subject: Core Data memory not freed after reset
- From: Sebastian Morsch <email@hidden>
- Date: Mon, 21 Sep 2009 14:40:33 +0200
Hi,
in my SQLite backed Core Data app, a search action fetches from a
large number of objects (>1.000.000) only to show them in a table.
When the user exits search mode (search string empty), I'd like to
free the managed objects to restore the app's normal memory footprint.
I do that by resetting the managed context, but it doesn't seem to
work, physical memory stays where it was when the fetch was completed.
Strangely, in ObjectAlloc instrument I can see the fetched objects
being deallocated, but the physical memory still peaks.
Here's the search action:
- (IBAction)search:(id)sender {
NSString *searchString = [sender stringValue];
NSManagedObjectContext *moc = [self managedObjectContext];
if ([searchString length]) {
// Reveal the file table
[self showFileTable:YES];
// Fetch
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"BackupFile" inManagedObjectContext:moc];
[request setEntity:entity];
[request setPredicate:[NSPredicate predicateWithFormat:@"sourcePath
CONTAINS[c] %@", searchString]];
// Do the fetch
NSArray *fetchedObjects = [moc executeFetchRequest:request
error:NULL];
[fileArrayController setContent:fetchedObjects];
} else {
// Hide the file table
[self showFileTable:NO];
[fileArrayController setContent:nil];
[moc reset];
}
}
Any ideas how I can get my nice seven-point-something MB footprint back?
Thanks,
Sebastian
_______________________________________________
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