Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data , NSFetchResultsController leaking
    primarykey
    data
    text
    <p>I am not sure if the leak is in my implementation or is it from apple's side....</p> <p>Instruments indicate me that I have a leak in this line : </p> <blockquote> <p>if (![[self fetchedResultsController] performFetch:&amp;error])</p> </blockquote> <p>I am adding annotations by reading the fetchController to the Map.... like this :</p> <pre><code>-(void)fillMapWithAnnotations{ NSError *error = nil; if (![[self fetchedResultsController] performFetch:&amp;error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } for(int a=0; a&lt;[[[fetchedResultsController sections]objectAtIndex:0] numberOfObjects]; a++){ LookAround *look=(LookAround *)[fetchedResultsController objectAtIndexPath:[NSIndexPath indexPathForRow:a inSection:0]]; if(look){ AddAnnotation *newAnnotation=[[AddAnnotation alloc]initWithLookAround:look]; if(newAnnotation){ [self.mapView addAnnotation:newAnnotation]; [newAnnotation release]; newAnnotation=nil; } } } } </code></pre> <p>and I initialize my FetchController like this:</p> <pre><code>- (NSFetchedResultsController *)fetchedResultsController{ // Set up the fetched results controller if needed. if (fetchedResultsController == nil) { // Create the fetch request for the entity. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate. NSEntityDescription *entity = [NSEntityDescription entityForName:@"LookAround" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; // Edit the sort key as appropriate. NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; // Edit the section name key path and cache name if appropriate. // nil for section name key path means "no sections". NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; [aFetchedResultsController release]; [fetchRequest release]; [sortDescriptor release]; [sortDescriptors release]; } return fetchedResultsController; } </code></pre> <p>I get a leak as soon as i Navigate Back, the ViewController gets Deallocated in which I release my fetch controller object.</p> <p>The objects that leak are numerous (and of the same type I guess) around the number of records in my sqlite DB</p> <p>Thanks in advance for your help....</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload