+ (NSArray *) fetchAllContactsInContext:(NSManagedObjectContext *)a_context
{
NSFetchRequest *_request = [[NSFetchRequest alloc] init];
[_request setEntity:[NSEntityDescription entityForName:@"Contact" inManagedObjectContext:a_context]];
NSSortDescriptor *_sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastName" ascending:YES];
NSArray *_sortDescriptors = [[NSArray alloc] initWithObjects:_sortDescriptor, nil];
[_request setSortDescriptors:_sortDescriptors];
NSError *_fetchError=nil;
NSArray *_results = [[NSArray alloc] initWithArray:[a_context executeFetchRequest:_request error:&_fetchError]];
[_sortDescriptor release];
[_sortDescriptors release];
[_request release];
if (_fetchError){
NSLog(@"Contact - Error fetching contacts %@", [_fetchError localizedDescription]);
}
[_fetchError release];
return [_results autorelease];
}
聞きたいのですが、この関数はメモリをリークしていますか? 実際、Instruments は、この関数が大量のメモリをリークしていると言っています。
メモリの問題を解決するのを手伝ってくれませんか?