Re: Simple instance [[alloc] init] question.
Re: Simple instance [[alloc] init] question.
- Subject: Re: Simple instance [[alloc] init] question.
- From: Brian Slick <email@hidden>
- Date: Mon, 30 Aug 2010 20:26:23 -0400
#1 is a leak.
(I'm assuming that "release" is supposed to be "retain" in the property declaration)
Brian
On Aug 30, 2010, at 8:23 PM, Frederick C. Lee wrote:
> Which is the preferred method of object allocation & initialization?
>
> <header file>.h
> @property(nonatomic, release) IRMSerialDetailsDO *serialIDs;
> ...
> <body>.m
> @synthesize mySerialIDDO
>
> ...
> // 1)
> self.serialIDs = [[IRMSerialDetailsDO alloc] init];
>
> or...
>
> // 2)
> IRMSerialDetailsDO *mySerialIDDO = [[IRMSerialDetailsDO alloc] init];
> self.serialIDDO = mySerialIDDO;
> [mySerialIDDO release];
>
>
> I would assume #1 is the simplest, but I see a lot of #2 .
>
> Thoughts?
>
> Ric.
> _______________________________________________
>
> 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
_______________________________________________
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