Super Dealloc in Assets


#1

Why doesn’t [super dealloc] have to be called?


#2

The same reason this class’s dealloc doesn’t have to be invoked, just defined: because calling it is the responsibility of the operating environment (or compiler, not sure off-hand which). We just define it to make sure that we clean up after ourselves.


#3

Sorry, I only half followed that. :blush: Are you saying that [super dealloc] will always be called in Assets dealloc method even if the programmer doesn’t explicitly call [super dealloc] in Assets dealloc method?


#4

Actually, I’m wrong. I hereby retire from the forums, because I keep getting things wrong lately (and because I’m increasingly convinced I’m never going to write Objective-C, anyway).

You’re right, from what I can determine [super dealloc] should be the last thing you call when you define dealloc.


#5

Oh that’s new I’m right for once. :slight_smile: So do you know why the author didn’t call [super dealloc] then?


#6

Oversight, perhaps? Might post it to the errata discussion (viewtopic.php?f=170&t=3495).


#7

Nvm. I found the answer here if you’re still curious: stackoverflow.com/questions/4566 … er-dealloc You were right! [super dealloc] automatically gets called at the end of dealloc :slight_smile:


#8

Thanks for this thread - it was killing me that there was no [super dealloc] call! I appreciate the help, and the pointer to the StackOverflow page.