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

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.

References: 
 >Factory AutoRelease (From: Bryan Rieger <email@hidden>)

  • Prev by Date: Re: finding menu titles from another running app...
  • Next by Date: Re: finding menu titles from another running app...
  • Previous by thread: Re: Factory AutoRelease
  • Next by thread: Disk Image Volumes
  • Index(es):
    • Date
    • Thread