Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

super dealloc on ARC subclasses

In ARC I'm aware that you do not call [super dealloc] in any overrides of -dealloc, so typically I remove observers and timers in there without doing so. However, if I were to subclass a view that I made that releases observation info in -dealloc without calling [super dealloc] in the subclass' implementation of the method, would the super implementation be called automatically to release the observation info handled by the superclass, or would it leak?

like image 981
Alex Zielenski Avatar asked Nov 30 '22 01:11

Alex Zielenski


1 Answers

The superclass' implementation of dealloc is automatically called (as far as I know, the compiler inserts the statement [super dealloc] for you).

External link to LLVM docs

Update

Here is the reference:

Custom dealloc methods in ARC do not require a call to [super dealloc] (it actually results in a compiler error). The chaining to super is automated and enforced by the compiler. Transitioning to ARC Release Notes

enter image description here

like image 80
herzbube Avatar answered Dec 10 '22 02:12

herzbube