Re: if statement causing 32 Byte leak?
Re: if statement causing 32 Byte leak?
- Subject: Re: if statement causing 32 Byte leak?
- From: Andy Lee <email@hidden>
- Date: Sat, 09 Jan 2010 20:48:52 -0500
On Jan 9, 2010, at 8:40 PM, Dave Keck wrote:
>> Discussion
>> This method is a combination of alloc and init. Like alloc, it initializes the isa instance variable of the new object so it points to the class data structure. It then invokes the init method to complete the initialization process.
>
> While we're on the topic, I always thought +new would be much more
> useful if it did autorelease the result, making it inline with class
> convenience constructors. Any specific reason why this isn't so?
Probably historical. I believe +new dates back to NextStep, before there was retain and release.
You could always add your own method in a category of NSObject. Not sure what to call it -- maybe +instantiate? The nice thing about using a sensible name is that it's sensible, but it runs the risk of collision if Apple ever decides to add a method with the same sensible name.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden