Re: Leaks with Core-Data while fetching data
Re: Leaks with Core-Data while fetching data
- Subject: Re: Leaks with Core-Data while fetching data
- From: Thomas Dingler <email@hidden>
- Date: Mon, 7 May 2007 21:43:26 +0200
Hi,
I've got an other problem where fetching needs memory and dont free
it. After debugging and testing about 2 hours I found out, that I had
NSZombieEnabled... Argh... So all fetched data was never
released :-/. Stupid me ;-)
Greetings,
Thomas
Am 07.05.2007 um 21:02 schrieb email@hidden:
I've used MallocDebug in order to see leaks and memory usage. I've
found that in my function:
- (ANTArtNode *)getArticleNodeForID:(NSString *) _id {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
ANTArtNode *node = nil;
NSExpression *right = [NSExpression expressionForConstantValue:
_id];
NSPredicate *pr = [NSComparisonPredicate
predicateWithLeftExpression: keypathmsgid rightExpression: right
modifier: NSDirectPredicateModifier type:
NSEqualToPredicateOperatorType options:
NSCaseInsensitivePredicateOption];
[request setPredicate: pr];
NSError *error;
NSArray *array = [[self managedObjectContext]
executeFetchRequest:request error:&error];
if (array != nil) {
node= [array lastObject];
} else {
NSLog(@"Error occurred in query: %@", [error description]);
return nil;
}
[pool release];
return node;
}
there are lots of NSPredicate objects marked as leaks:
NSPredicate *pr = [NSComparisonPredicate
predicateWithLeftExpression: keypathmsgid rightExpression: right
modifier: NSDirectPredicateModifier type:
NSEqualToPredicateOperatorType options:
NSCaseInsensitivePredicateOption];
Is possible to generate a single NSPredicate and change the right
expression each time I need? I've created a single istance of left
expression and NSRequest but I still not found a method to do it.
it could be a solution.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden