Re: NSAutoreleasePool
Re: NSAutoreleasePool
- Subject: Re: NSAutoreleasePool
- From: "Erik M. Buck" <email@hidden>
- Date: Sun, 17 Feb 2002 23:35:34 -0600
- Organization: EMB & Assocites Inc.
Why would you release an NSDirectoryEnumerator ? It was given to you. You
did not allocate it or copy it or retain it, so why release it ? The types
of errors your describe are very easy to avoid by simply consistently
applying the rules.
----- Original Message -----
From: "Jonathan Wight" <email@hidden>
To: "Cocoa Dev List" <email@hidden>
Sent: Sunday, February 17, 2002 10:55 PM
Subject: NSAutoreleasePool
>
I've just been spending a fair chunk of today debugging a problem where I
>
was neglecting to retain a NSDirectoryEnumerator which I got from a
>
NSFileManager enumeratorAtPath message... The program would always
segfault
>
at the release of my Foundation tool's NSAutoreleasePool. Which
corresponded
>
to the autorelease pool dealloc-ing the enumerator which I had previously
>
dealloced.
>
>
Now the bug was totally my fault but despite trying as hard as I could I
was
>
unable to gleen any information from the runtime concerning what was
causing
>
the problem (I even posed a NSObject subclass to help me debug the ref
>
counting ).
>
>
I have learnt my lesson but I can't guarantee I won't do a similar thing
>
again a month from now. Is there some way to actually find out what object
>
NSAutoreleasePool was choking on?
>
>
Cheers.
>
>
Jon.
>
_______________________________________________
>
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.
_______________________________________________
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.