Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why ARC is not deallocating memory after popViewController

I'm pushing and popping ViewControllers in UINavigationController.

I'm tracking the memory consumption of my app. While pushing the new viewController the memory consumption is increasing gradually, but when I'm popping the same ViewController using [self.navigationController popViewControllerAnimated:NO]; the memory consumption does not decrease but the constant.

That particular viewController can be pushed and popped by user many times which can lead the high memory consumption of app in RAM.

What should I do to optimise my memory consumption?

like image 300
Wali Haider Avatar asked Jan 28 '14 07:01

Wali Haider


2 Answers

When you dismiss a view controller (or pop it), it will be deallocated if you didn't make any strong pointers to it (that controller is retained by the navigation controller, or the presenting view controller, so you usually don't need to have a pointer to it when you create it and push or present it).

It will be be released if there are no other strong pointers to it

like image 193
Shardul Avatar answered Oct 23 '22 08:10

Shardul


Try to avoid using strong properties for IBOutlets.

like image 4
Naga Mallesh Maddali Avatar answered Oct 23 '22 09:10

Naga Mallesh Maddali