On Aug 30, 2010, at 9:36 PM, Dave Geering wrote:
>
> I apologise. I was going to explain each one in terms of ownership,
> but I couldn't figure out a way to explain how you own something twice
> without talking about reference counts. I should probably refrain from
> replying to the list any ti
>>> // 1)
>>> self.serialIDs = [[IRMSerialDetailsDO alloc] init];
>>
>> The alloc method allocates an instance with a retain count of 1, and
>> assigning it to the serialIDs property bumps it up to 2. In your
>> dealloc method, you will [hopefully] send it a release message which
>> puts it back at
On Aug 30, 2010, at 6:37 PM, Dave Geering wrote:
>> // 1)
>> self.serialIDs = [[IRMSerialDetailsDO alloc] init];
>
> The alloc method allocates an instance with a retain count of 1, and
> assigning it to the serialIDs property bumps it up to 2. In your
> dealloc method, you will [hopefully] send
Assuming his @property was supposed to be (nonatomic,retain)
We did the release explicitly when doing some sample code on iPhone. We didn’t
want the autorelease pool to grow.
IRMSerialDetailsDO *mySerialIDDO = [[IRMSerialDetailsDO alloc] init];
self.serialIDDO = mySerialIDDO;
[mySerialIDDO relea
On Aug 30, 2010, at 7:23 PM, Frederick C. Lee wrote:
> // 1)
> self.serialIDs = [[IRMSerialDetailsDO alloc] init];
This is, as mentioned, a leak, although if performance is not an issue, you can
still have the simplicity:
self.serialIDs = [[[IRMSerialDetailsDO alloc] init] autorelease];
Charle
> // 1)
> self.serialIDs = [[IRMSerialDetailsDO alloc] init];
The alloc method allocates an instance with a retain count of 1, and
assigning it to the serialIDs property bumps it up to 2. In your
dealloc method, you will [hopefully] send it a release message which
puts it back at 1, but this mean
#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?
>
> .h
> @property(nonatomic, release) IRMSerialDetailsDO *seria