Re: Factory AutoRelease
Re: Factory AutoRelease
- Subject: Re: Factory AutoRelease
- From: "Clark S. Cox III" <email@hidden>
- Date: Mon, 5 May 2003 13:02:20 -0400
On Sunday, May 4, 2003, at 17:45 US/Eastern, Bryan Rieger wrote:
How can you tell if an object created by a class factory method calls
autorelease on an object before it returns it to the caller. ie
myScanner = [NSScanner scannerWithString: aString];
is myScanner already in the autorelease pool?
Yes, but since you didn't create (i.e. you didn't call +alloc, -copy,
or +new), you shouldn't worry about it. You know that it will be around
for at least the scope of the current autorelease pool.
Basically, stick to the following rules:
Every -retain must be matched by a -release or -autorelease.
A call to +alloc, +new or -copy counts as a retain
A call to any other factory method *does not* count as a retain
--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
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.