Skip navigation.
 
mlRe: Downloading image from web and memory usage questions
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.


Related mailsAuthorDate
mlDownloading image from web and memory usage questions John Tsombakos Jan 24, 22:05
mlRe: Downloading image from web and memory usage questions Shawn Erickson Jan 24, 22:54
mlRe: Downloading image from web and memory usage questions John Tsombakos Jan 24, 23:46
mlRe: Downloading image from web and memory usage questions Jeremy Erwin Jan 25, 00:23
mlRe: Downloading image from web and memory usage questions James J. Merkel Jan 25, 11:45
mlRe: Downloading image from web and memory usage questions Shawn Erickson Jan 25, 12:43
mlRe: Downloading image from web and memory usage questions Shawn Erickson Jan 25, 13:01
mlRe: Downloading image from web and memory usage questions James J. Merkel Jan 25, 13:36
mlRe: Downloading image from web and memory usage questions Jeremy Erwin Jan 25, 13:42
mlRe: Downloading image from web and memory usage questions Shawn Erickson Jan 26, 08:56