Do I need use dealloc method with ARC?

Spread the love

Question Description

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:

    fileDescription = nil;

If not, who will dismiss memory used by fileDescription?

Practice As Follows

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.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.