Is this a right code from the point of view of memory management?
NSEntityDescription *description = [NSEntityDescription
entityForName:@"Event" inManagedObjectContext:managedObjectContext];
NSFetchRequest *eventRequest = [[[NSFetchRequest alloc] init] autorelease];
[eventRequest setEntity:description];
[description release];
NSPredicate *eventPredicate = [NSPredicate predicateWithFormat:
@"(event == %@)", [item objectForKey:@"event"]];
[eventRequest setPredicate:eventPredicate];
Or i need to release description and eventPredicate?
Thanks
Looking at that code, the only object you own is the
eventRequest. It is being autoreleased so you don’t need to release it again.From what I can see, based on naming convention, all the other objects aren’t owned, so you don’t need to release them.
The line
[description release];will likely cause a crash for you somewhere down the line.