I would like to learn about memory management in Objective-C, which I find not so simple, because I'm pretty new to Objective-C and ARC, and I mostly use script languages for which I don’t know how to deal with this (or not at all) with memory management.
The application I'm working on is a viewController (with an attached xib file) from the code after clicking a button. In this controller view, I have several views; I record a sequence of images (camera photos saved to disk) that I convert to a movie, and I have a gps tracker (mapKit) that displays a small map on the screen. In the end, I can click the "done" button, which calls [self dismissViewControllerAnimated:YES completion:nil];
The ViewController is animated back to my rootViewController and because I put the NSLog message inside the dealloc method in the viewController dispatcher, which is rejected, I can confirm that this viewController is freed.
The problem is that I see an increase in memory after using the application (the use consists of shooting and recording gps locations on a MapKit map, as well as creating a video file) to about 80 MB, and this drops to 70 MB when I click "done", so viewController is rejected and the application returns to my rootViewController. I can again introduce the same viewController, use it and fire it, and the application will still take about 70 MB of memory, which will not fall. Actually, this does not look like a memory leak, because in this case I would expect a constant memory growth with each instance and the dismissal of the viewController. This is not the case, even if I have different buttons in my root controller that all create a new and unique instance of my viewController class.
I am wondering: is there something I should look for or is this the expected behavior? Maybe the application caches classes for future use? With a memory management rule, should I expect the application to return to the state of "virgin" memory (in this case it will be about 4 MB) after firing the only viewController that was presented?
Hype1 source share