Dealloc method on Lottery.m


#1

In the sample code, when I send the release message to the array object,

for(LotteryEntry *entryToPrint in array) { // Display its contents NSLog(@"%@", entryToPrint); } [array release];

I expect the LotterEntry objects to get released and their dealloc method to be executed. This doesn’t happen in my case. The program execution just terminates. Is this normal?

I thought when the array object was released, it was supposed to walk through each object it points to and call the corresponding object’s dealloc method.

What am I missing?


#2

How do you know they are not being released?

Do you mean that you are NSLogging from the dealloc method and the logs are not showing up on the console?


#3

iBex10,

Correct. The samples in the book have you write to the NSLog in the dealloc method and those are never appearing.