Overriding dealloc


#1

I have a question about overriding the dealloc method with BNRItem (to print to the console when each BNRItem is destroyed).
If we override dealloc and just put NSLog(@“Destroyed: %@”, self); then does that mean that the BNRItems are not actually destroyed? Or does it not matter how we override the dealloc method, and ARC just destroys them on its own?


#2

ARC will do what it can to destroy the object in the dealloc. You can think of dealloc as an object’s last meal, once that method is finished running, it can never be accessed again.

All Objective-C pointers will be handled appropriately regardless of whether dealloc is implemented or not. However, any other cleanup (like malloc’ed memory) needs to be freed in dealloc.


#3

Shouldn’t overriden dealloc include a call to super: [super dealloc]?