Ans : Automatic Reference Counting is memory management feature in iOS that provides automatic referencing counting system. According to attribute type of property like retain and release, it increment and decrements reference count at runtime.
ARC is does not handle reference cycle automatically.
Unlike garbage collection, ARC does not handle reference cycles automatically.
Default property attributes :
i> Memory management : strongweak copy assign
ii> Thread Safety : atomicnonatomic
iii> Mutability : readwritereadonly
@property (strong, atomic, readwrite) NSArray *name;
For IBOutlet,
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (weak) IBOutlet UILabel *instructions;
In 2015, apple recommend to use Strong.
To stop retain cycle, user should mention weak reference when needed.
Q : What is retain?
A.Retain works same as Strong according to apple document. If we assign retain, it will convert to strong or consider as Strong.
Read : Difference between Strong and Weak attribute
ARC is does not handle reference cycle automatically.
Unlike garbage collection, ARC does not handle reference cycles automatically.
Default property attributes :
i> Memory management : strong
ii> Thread Safety : atomic
iii> Mutability : readwrite
For IBOutlet,
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (weak) IBOutlet UILabel *instructions;
In 2015, apple recommend to use Strong.
To stop retain cycle, user should mention weak reference when needed.
Q : What is retain?
A.Retain works same as Strong according to apple document. If we assign retain, it will convert to strong or consider as Strong.
Read : Difference between Strong and Weak attribute
No comments:
Post a Comment
Thanks