On Fri, Mar 13, 2009 at 3:51 AM, Mike Abdullah <[email protected]> wrote: > By definition, if it's a singleton, it will exist for the lifetime of the > program; there is no risk of the notification centre sending messages to a > now non-existent object.
As a smallish nit... "singleton" nominally implies that only one instance of the singleton class will exist at runtime (for some module boundary) and not that it will and must exist for the life of application. ...of course fairly often singletons do end up with process long life times. In my opinion singletons should normally be written to only exist as long as a client exists or as long as needed to maintain state across the existence of clients or to avoid instantiation related performance issue, etc.. I try to always write them with proper memory management (and unit test them that way) even if they end up living for the life of the application just to make it easier to change its life time in the future (code likes to evolve) without having worry about auditing the memory management it does. So in this particular situation this singleton could be told to go away by the app delegate as one of the last things it does ... of course application termination is going to reap all of these objects so you likely don't need to do anything. -Shawn _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
