Re: Will this leak memory?
Re: Will this leak memory?
- Subject: Re: Will this leak memory?
- From: "Clark S. Cox III" <email@hidden>
- Date: Fri, 5 Sep 2003 14:05:56 -0400
On Sep 05, 2003, at 10:01, Alastair J.Houghton wrote:
On Friday, September 5, 2003, at 02:36 pm, Neil Earnshaw wrote:
Will this implementation of the Singleton pattern leak memory in
Obj-C?
+(id)defaultObject
{
static MyObject* defaultObject;
You need to initialise defaultObject... that is, it should be
static MyObject *defaultObject = nil;
rather than just
static MyObject *defaultObject;
No, static variables are automatically initialized to zero.
--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
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.