views:

35

answers:

1

Im using XCode 3.2.3 and have created an app using the SplitView template with Core Data. When i run the default app on the device (3.2) in debug mode with instruments running i am seeing a leak. When the default app has no items added to the table view within the split view there is no leak. But after adding items and running the app a leak is reported.

Responsible Frames are ....

NSPushAutoreleasePool +[NSThread currentThread] WTF:initializeMainThreadPlatform() WTF:initializeMainThreadPlatform() WTF:initializeMainThreadPlatform()

I beleive the issue happens when fetchedResultsController is called

- (NSFetchedResultsController *)fetchedResultsController {

if (fetchedResultsController != nil) {
    return fetchedResultsController;
}

/*
 Set up the fetched results controller.
 */
// Create the fetch request for the entity.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:entity];

// Set the batch size to a suitable number.
[fetchRequest setFetchBatchSize:20];

// Edit the sort key as appropriate.
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"timeStamp" ascending:NO];
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;

}

Any advice or pointers appreciated.

A: 

It's rather quiet here. I would have thought this was easy for someone to test if they have the time. It would take all of 60 seconds. I didnt add any code to the template code for SplitView with Core data.

Mattyd