Re: Will this leak memory?
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.