Memory management in iOS was initially non-ARC (Automatic Reference Counting), where we have to maintain and release the objects. Now, it supports ARC and we don't have to maintain and release the objects. Xcode will take care of the job automatically in compile time.
According to Apple documentation, the two main issues in memory management are −
You don't require to use release and maintain in ARC. So, all the view controller's objects will be released when the view controller is removed. In the same way, any object’s sub-objects will be released when they are released. Note that if other classes have a strong reference to an object of a class, then the whole class will not be released. So, it is suggesthed to use weak properties for delegates.
We can inspect the usage of memory by the help of Xcode tool instruments. It includes tools like Activity Monitor, Allocations, Leaks, Zombies, and so on.
Step 1.Open an existing application.
Step 2.Select Product and then Profile as shown in the below screen shot.
Step 3.Select Allocations in the next screen displayed below and select Profile.
Step 4.We will view the allocation of memory for various objects as shown below.
Step 5 You can switch between view controllers and check if the memory is released properly or not.
Step 6. In the same way, in place of Allocations, we can employ Activity Monitor to view the overall memory allocated for the application.
Step 7.These tools will help us access our memory consumption and locate the places where possible leaks have been occurred.
IOS Related Interview Questions
|C Interview Questions||IPHONE APPS Interview Questions|
|Android Interview Questions||Mobile Testing Interview Questions|
|Java Native Interface (JNI) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Mobile computing Interview Questions||jQuery Mobile Interview Questions|
|Mobile Security Interview Questions||Objective C Interview Questions|
|Mobile Developer Interview Questions||Mobile Application Testing Interview Questions|
|Mobile Marketing Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.