• 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: Neil Earnshaw <email@hidden>
  • Date: Fri, 5 Sep 2003 18:34:27 +0100

Thanks Guys,

I get paranoid about deallocating objects. The log message from dealloc wasn't being called when the program exited, hence my question.

Thanks again,

-Neil

Will this implementation of the Singleton pattern leak memory in Obj-C?

+(id)defaultObject
{
static MyObject* defaultObject;

if ( !defaultObject ) {
defaultObject = [[MyObject alloc] init];
}
return defaultObject;
}

-(void)dealloc
{
NSLog(@"%@ dealloc",self);
...
[super dealloc];
}

The dealloc log message never gets called.

-Neil

Neil Earnshaw
Consultant Software Engineer
Object Software Engineers Ltd
email@hidden
Tel : 01747 854 852
Mbl : 07870 209 102
_______________________________________________
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.


Neil Earnshaw
Consultant Software Engineer
Object Software Engineers Ltd
email@hidden
Tel : 01747 854 852
Mbl : 07870 209 102
_______________________________________________
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.

References: 
 >Will this leak memory? (From: Neil Earnshaw <email@hidden>)

  • Prev by Date: Make NSTextField only send action on <Return>
  • Next by Date: Re: Make NSTextField only send action on <Return>
  • Previous by thread: RE: Will this leak memory?
  • Next by thread: RE: Subclassing dictionaries?
  • Index(es):
    • Date
    • Thread