Re: Never ending lack of memory
Re: Never ending lack of memory
- Subject: Re: Never ending lack of memory
- From: Dietrich Epp <email@hidden>
- Date: Mon, 10 Mar 2003 13:50:23 -0800
I made a typo below, I meant to pet the [aPool release] at the end of
the loop. Also there is a nicer way to deal with the strings.
On Monday, Mar 10, 2003, at 02:43 US/Pacific, Dietrich Epp wrote:
- (BOOL)ScanSingleFolder:(NSString*)sourceDir
{
int i;
NSMutableString *subItem = [NSMutableString string];
Make this:
NSString* subItem;
BOOL isDir;
NSArray *dirContent = [manager
directoryContentsAtPath:sourceDir];
NSAutoReleasePool* aPool;
for(i = 0; i < [dirContent count]; i++){
if(isCopying == NO) break;
aPool = [[NSAutoReleasePool alloc] init];
[subItem setString:[sourceDir
stringByAppendingPathComponent:[dirContent objectAtIndex:i]]];
Rather than setting a mutable string, you could do this:
subItem = [sourceDir stringByAppendingPathComponent:[dirContent
objectAtIndex:i]];
[manager fileExistsAtPath:subItem isDirectory:&isDir];
Swap the next two lines:
[aPool release];
if(isDir) [self ScanSingleFolder2:subItem];
}
return YES;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.