ios - When a view controller is dismissed, should it empty the memory? -


i'd learn memory management in objective-c find not easy because i'm new @ objective-c , arc , i'm used script languages don't have deal (or not @ all) memory management.

the app i'm working on presenting viewcontroller (with xib file attached) code after press of button. in view controller have several views instantiated; record sequence of images (photo's camera, saved disk) convert movie , have gps tracker (mapkit) display's little map on screen. after done can push 'done' button calls [self dismissviewcontrolleranimated:yes completion:nil];

the viewcontroller animated rootviewcontroller , because put nslog message inside dealloc method in viewcontroller being dismissed can confirm viewcontroller being deallocated.

the problem see memory rise after use of app (usage consists of taking pictures , recording gps locations on mapkit map generate movie file) 80 mb , drops 70mb when press 'done' viewcontroller dismisses , app returns rootviewcontroller. can present same viewcontroller again, use , dismiss it, , app still occupy around 70mb of memory doesn't drop. not memory leak me because in case expect steady rise of memory every instantiation , dismissal of viewcontroller. isn't case if have different buttons in rootviewcontroller instantiate new , unique instance of viewcontroller class.

i wondering: there should or expected behavior? maybe app caching classes future use? memory management done right, should expecting app revert 'virgin' memory state (in case around 4 mb) after dismissal of viewcontroller presented?

if seeing memory rise in xcode , not when using instruments the answer have come in answer.

you can read whole answer, it's pretty in depth. long story short, in xcode seeing amount of memory os has "given" app use. increase time app tries allocate something. not decrease fast because os performance guesses thinking app may need more memory in future. faster os leave memory "given" app take away , give later.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -