• 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: NSAutoreleasePool problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAutoreleasePool problem


  • Subject: Re: NSAutoreleasePool problem
  • From: Angela Brett <email@hidden>
  • Date: Thu, 14 Mar 2002 23:07:47 +1300

2002-03-14 10:46:20.262 SimpleLister[424] *** _NSAutoreleaseNoPool(): Object
0x1c74770 of class NSAllDescendantPathsEnumerator autoreleased with no pool
in place - just leaking

-> What does this error means..? I have some problems with
NSAutoreleasePool...but i don't know what to do...my method looks like this:

- (IBAction)List:(id)sender
{
int all;

NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager]
enumeratorAtPath:[path stringValue]];
NSString *fullPath = [path stringValue];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

I'd say you have to move the line NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; above the other ones, or else assign the values to direnum and fullPath later in the code instead of where they're declared. The way it is, you're using

[[NSFileManager defaultManager]
enumeratorAtPath:[path stringValue]];
and

[path stringValue];

which both return autoreleased objects (at least the first one does - that seems to be what's causing the error message), before setting up an autoreleasePool. If you try to autorelease an object when there's no autoreleasePool in place it won't work - you get that error - and it will leak memory because the objects will not be released since they couldn't be put into an autorelease pool.
--
Angela Brett email@hidden http://acronyms.co.nz/angela
"[I] am rarely happier when spending an entire day programming my computer to
perform automatically a task that it would otherwise take me a good ten seconds
to do by hand" -- Dounglas Adams in 'Last Chance to See'
_______________________________________________
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: 
 >NSAutoreleasePool problem (From: Lukasz Kuczborski <email@hidden>)

  • Prev by Date: Re: Help with CFXML?
  • Next by Date: Re: Run an AppleScript from Objective-C?
  • Previous by thread: NSAutoreleasePool problem
  • Next by thread: Terminating process
  • Index(es):
    • Date
    • Thread