Closing memory leaks

Usually, if you navigate around in your app, it's normal to see memory usage spike a little. More view controllers on a navigation controller's stack mean that more memory will be consumed by your app. This makes sense. When you navigate back, popping the current view controller off the navigation controller's stack, you would expect the view controller to be deallocated and the memory to be freed up.

The preceding scenario describes how Mosaic should work. It's OK if the app uses some more memory if you're deeper in the navigation stack, but this memory should be freed up after the back button is tapped.

In the Mosaic app, the memory keeps growing every time you navigate to a new collection view. It doesn't matter if you drill deep into the navigation stack, hit back, or scroll a lot, once memory is allocated it never seems to be deallocated. This is a problem, and you can use Instruments to dig into the app to find out what's wrong. Before you do this, though, let's have a deeper look at memory leaks, how they occur, and what the common causes are.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.70.93