Reputation: 12184
If I miss a call to super's dealloc, is it explicitly added by the compiler or If I want to release something inherited from super class, I need an explicit call to super's dealloc in the end of my dealloc.
Upvotes: 0
Views: 42
Reputation: 181077
If you're using ARC
, the call to [super dealloc]
is automatically added by the compiler, and you'll get a compilation error if you try;
A program is ill-formed if it contains a message send or @selector expression for the selector dealloc.
...
The superclass’s implementation of dealloc will be called automatically when the method returns.
If you're not using ARC, you need to add it yourself.
Upvotes: 1
Reputation: 40221
If you're using ARC, you must not call super (I think it will yield an error anyway) as it will be called for you automatically. And if you're not using ARC, then you have to call super. The compiler does not do it for you.
Upvotes: 1