I've narrowed a memory leak problem down to this specific block of code:
NSFetchRequest *req = [NSFetchRequest new];
NSEntityDescription *descr = [NSEntityDescription entityForName:@"Capture" inManagedObjectContext:dataContext];
[req setEntity:descr];
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"created_at" ascending:NO];
[req setSortDescriptors:[NSArray arrayWithObject:sort]];
[sort release];
NSError *error;
NSArray *ret = [dataContext executeFetchRequest:req error:&error];
[req release];
This block exists in either the init
or viewDidLoad
method for a view controller a layer or two down in the navigation controller.
Where I'm confused and not sure what to do is that I'm getting memory leaks with this code related to CoreGraphics, Foundation, and even JavaScript Core, but I'm unsure how to correct the problem (not sure what the problem is). This only happens when running Instruments on the Device installation, not the Simulator.
[ This won't let me post the photo of Instruments, So here's the photo: http://twitpic.com/27vwm1 ]
By way to background, my Core Data model used to have a property that held a transformed UIImage, but I've since converted that to an NSNumber and rebuilt the object classes for my project. Could that have something to do with it and is there another step I need to take when changing around my model?
Thx
*Update: * changed URL for picture