• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Never ending lack of memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Never ending lack of memory (From: Dietrich Epp <email@hidden>)

  • Prev by Date: Re: Grep Support in Cocoa
  • Next by Date: Code for parsing Objective-C files?
  • Previous by thread: Re: Never ending lack of memory
  • Next by thread: Re: Never ending lack of memory
  • Index(es):
    • Date
    • Thread