FROM : Shawn Erickson
DATE : Sun Jan 26 08:56:01 2003
On Saturday, January 25, 2003, at 01:34 PM, James J. Merkel wrote:
> On Saturday, January 25, 2003, at 12:38 PM, Shawn Erickson wrote:
>> I believe the NSLog that is printing out a retain count of zero is
>> before the image has been alloced and initialized (the image pointer
>> is still set to nil). In other words he is sending a retainCount
>> message to a nil object, this is not a hard error but the return
>> value is undefined in this case.
>
> Ok. However, it looks like I have to explicitly set the object to nil.
> For example, if I do the following before allocate and initialize:
>
> myObject = nil;
> NSLog(@"Retain count = %d\n" , [myObject retainCount] );
>
> The retain count of 0 is printed out. However if I don't set myObject
> to nil, I get a crash.
Didn't look at the code closely...
FYI... vars in methods are not auto initialized to zero, ivars in
objects are.
DATE : Sun Jan 26 08:56:01 2003
On Saturday, January 25, 2003, at 01:34 PM, James J. Merkel wrote:
> On Saturday, January 25, 2003, at 12:38 PM, Shawn Erickson wrote:
>> I believe the NSLog that is printing out a retain count of zero is
>> before the image has been alloced and initialized (the image pointer
>> is still set to nil). In other words he is sending a retainCount
>> message to a nil object, this is not a hard error but the return
>> value is undefined in this case.
>
> Ok. However, it looks like I have to explicitly set the object to nil.
> For example, if I do the following before allocate and initialize:
>
> myObject = nil;
> NSLog(@"Retain count = %d\n" , [myObject retainCount] );
>
> The retain count of 0 is printed out. However if I don't set myObject
> to nil, I get a crash.
Didn't look at the code closely...
FYI... vars in methods are not auto initialized to zero, ivars in
objects are.
| Related mails | Author | Date |
|---|---|---|
| John Tsombakos | Jan 24, 22:05 | |
| Shawn Erickson | Jan 24, 22:54 | |
| John Tsombakos | Jan 24, 23:46 | |
| Jeremy Erwin | Jan 25, 00:23 | |
| James J. Merkel | Jan 25, 11:45 | |
| Shawn Erickson | Jan 25, 12:43 | |
| Shawn Erickson | Jan 25, 13:01 | |
| James J. Merkel | Jan 25, 13:36 | |
| Jeremy Erwin | Jan 25, 13:42 | |
| Shawn Erickson | Jan 26, 08:56 |






Cocoa mail archive

