Search Kit memory management
Search Kit memory management
- Subject: Search Kit memory management
- From: Michael Thon <email@hidden>
- Date: Sat, 31 Jul 2010 09:24:01 +0200
I am indexing a large set of files using Search Kit. I find that memory usage (reported by Activity Monitor) keeps growing in my app, as it indexes more documents. I don't find any memory leaks. In Instruments, I find that there can sometimes be hundreds of SKDocumentRef objects marked as living, though I would expect that I should only have one of those objects retained at a time. I guess there is something basic about memory management that I don't understand. Can anyone see something wrong with this code?
Thanks
NSDirectoryEnumerator *dirEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:folderToIndex];
NSString *item;
while ((item = [dirEnumerator nextObject]) != nil) {
//NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init];
NSString *fullPath = [folderToIndex stringByAppendingPathComponent: item];
NSURL *url = [NSURL fileURLWithPath: fullPath];
SKDocumentRef doc = SKDocumentCreateWithURL((CFURLRef) url);
//[(id) doc autorelease];
Boolean success = SKIndexAddDocument (
(SKIndexRef) theIndex,
(SKDocumentRef) doc,
(CFStringRef) NULL,
(Boolean) true );
if (success == false) {
NSLog(@"some problem inserting the document into the database");
}
CFRelease(doc);
url = nil;
fullPath = nil;
//[innerPool release];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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