• 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: "Shawn Erickson" <email@hidden>
  • Date: Thu, 20 Nov 2008 13:58:45 -0800

On Thu, Nov 20, 2008 at 1:04 PM, Adam Leonard <email@hidden> wrote:

> However, I think it *would* be a bad idea to call [[[NSWorkspace
> sharedWorkspace]retain]autorelease]
> A good singleton will override -retain, -release, and -autorelease to do
> nothing and return an appropriate value. But since you know it's a singleton
> (through appropriate documentation), you really shouldn't be doing any
> memory management with it.

IMHO it is never a bad idea to manage an objects life time using
proper retain/release semantics, you shouldn't care that it is a
singleton, you should treat it just as any other object. I say this
because it is possible that at some point in the future it may no
longer be a singleton (granted for ones documented by Apple to be a
singleton you could make such assumptions but still I think you should
treat it like any other object).

In my own code when I write or use a singleton (app-life long
singleton) of my own creation I always treat it as an object that I
need to manage the life time of. I even implement and maintain a
proper dealloc method in the singleton. This allows me the freedom
change it away from being a singleton in the future in the need
arises.

-Shawn
_______________________________________________

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: NSImageView and releasing it's images...
  • Next by Date: Re: BAD_EXC_ACESS
  • Previous by thread: Re: Autorelease Question
  • Next by thread: Re: Autorelease Question
  • Index(es):
    • Date
    • Thread