Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need use dealloc method with ARC?

So, I have class:

@interface Controller : NSObject {     UILabel* fileDescription; }  @property(strong, nonatomic) UILabel* fileDescription; 

Do I need use method dealloc where property fileDescription will equal nil?
For example:

-(void)dealloc {     fileDescription = nil; } 

If not, who will dismiss memory used by fileDescription?

like image 729
Vit Avatar asked Jan 24 '13 12:01

Vit


1 Answers

Generally you don't need to provide a subclassed dealloc method as ARC manages the lifetime of the instance variables.

However it can be useful to perform clean-up other than releasing objects, for example to remove an observer or close a network connection down cleanly. You are therefore allowed to subclass dealloc under ARC, but you are not allowed to call [super dealloc] from within the subclassed method.

In your particular case it's not required, however.

like image 167
trojanfoe Avatar answered Sep 18 '22 12:09

trojanfoe