• 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: Will this leak memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Will this leak memory?


  • Subject: Re: Will this leak memory?
  • From: publiclook <email@hidden>
  • Date: Fri, 5 Sep 2003 11:22:04 -0400

On Friday, September 5, 2003, at 10:08 AM, lbland wrote:


If it is a Singleton then why not overload your release method:

- (void)release
{
NSLog(@"Hey you! don't release me!");

// repeat 3 times...
// I will not call this, I will not call this, I will not call this: [super release];

}


Because it is perfectly normal to add singleton instances to collections and later remove them. Collections retain the instance when it is added and release it when it is removed. It is perfectly proper to send the release message to a singleton following the normal reference counting semantics.

It is NOT proper to copy a singleton or send so many release messages that dealloc is called prior to program termination, but it is NEVER proper to misuse release.
_______________________________________________
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.
  • Follow-Ups:
    • Re: Will this leak memory?
      • From: Shaun Wexler <email@hidden>
References: 
 >Re: Will this leak memory? (From: lbland <email@hidden>)

  • Prev by Date: Split views, tab views and IB
  • Next by Date: Re: cocoa-dev digest, Vol 2 #2893 - 16 msgs
  • Previous by thread: Re: Will this leak memory?
  • Next by thread: Re: Will this leak memory?
  • Index(es):
    • Date
    • Thread