Google News
logo
IOS - Interview Questions
What is ARC (Automatic Reference Counting)?
In the Swift programming language, automatic reference counting (ARC) is used to manage apps' memory usage. It initializes and deinitializes system resources, thereby releasing memory reserved by a class instance when it no longer needs it. ARC keeps track of how many properties, constants, and variables currently refer to each class instance. When there is at least one active reference to an instance, ARC will not deallocate that instance. The use of ARC concepts is an essential part of iOS development.  
 
Functions of ARC :
 
* ARC creates a new class instance using init() and allocates a chunk of memory to store the information.
* Memory stores information about the instance type and its values.
* As soon as the class instance is no longer required, ARC automatically frees memory by calling deinit().
* By tracking current referring classes' properties, constants, and variables, ARC ensures that deinit() is only applied to those instances that are unused.
Advertisement