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

Re: Autorelease Question


  • Subject: Re: Autorelease Question
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 20 Nov 2008 16:33:52 -0500

On Nov 20, 2008, at 4:04 PM, Adam Leonard wrote:

Now, I agree that it is mostly paranoia, but it is simply incorrect to say that any object you send autorelease to, or get through a method "whose name [DOES NOT] begins with "alloc" or "new" or contains "copy"" will be sent release in the next run loop.

Actually, it *is* correct to say that any object to which you send - autorelease will definitely will be sent a -release message the next time around the run loop. What is incorrect is to assume that it will necessarily be deallocated as a result of that -release message.


Thus, I sometimes see code that declares an instance variable "workspace," assigns it to [NSWorkspace sharedWorkspace] in an init method, then just uses it wherever, never bothering to retain it or anything.
While I think that's a pretty stupid way to save a little bit of typing

... especially given that there's an existing global variable NSApp for precisely that purpose. :-)


sherm--

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Autorelease Question (From: "Carmen Cerino Jr." <email@hidden>)
 >Re: Autorelease Question (From: Joseph Crawford <email@hidden>)
 >Re: Autorelease Question (From: Alexander Spohr <email@hidden>)
 >Re: Autorelease Question (From: Adam Leonard <email@hidden>)

  • Prev by Date: Re: Autorelease Question
  • Next by Date: Re: NSArrayController and table column bindings retain/dealloc woes
  • Previous by thread: Re: Autorelease Question
  • Next by thread: Re: Autorelease Question
  • Index(es):
    • Date
    • Thread