Memory being reduced when iPhone screen is locked

I have an XCode application that I'm debugging, and I'm wondering how my memory usage via Inspector is acting like this:


http://i.stack.imgur.com/Xsr2Y.png


Flat portions - music playing in the background

'Steps up' - music is changed and album art is being changed in the MPNowPlayingInfoCenter

Drastic reduction in heap memory - application got focus, and then the "lock" button on the device activated


What is causing the memory to be allocated when the applciation gains focus and then gets put to sleep? What notifications/messages get called to reduce the memory footprint when the phone is going into locked mode? I've been trying to debug this to no success. Thank you!

When the phone locks, your application is put into the background. When that happens, any memory used to represent drawn UIViews is discarded, which should result in a drastic reduction of memory usage in many cases. The same sort of thing also happens for OpenGL or Metal based apps, but the usage is usually less drastic (since only the final drawing buffers are discarded, not all of the other content you have provided).

Memory being reduced when iPhone screen is locked
 
 
Q