This next Myth is something very near and dear to my heart.
"Can you free memory by killing an app?"
Here are the tools used for the project.
My iPhone 4S running iOS 5.1.1.
System Status - By Techet
Tiger Woods PGA TOUR® 12 - By Electronic Arts
First lets start with the cliffnote's version of the answer. Drum roll please.
The answer is: Maybe!
Several factors come into play for this Myth.
1) Size of the App.
2) Amount of memory already in use.
3) The definition of "freeing memory".
Yes, you read that correctly. The definition of "freeing memory" is not very cut and dry. BTW, this is why there has been so much confusion over the years when people discuss this subject.
But first lets talk about how to kill an application on the iPhone.
Double click the home button.
Select the app and long press it.
Once it starts to wiggle release.
Now click Red and White symbol in the corner.
You just killed the app.
So lets start with a freshly hard booted* iPhone in airplane mode.
*See the myth "What survives a reboot" for the definition and procedure.
The image above is a lot to take in for the first time. It shows the five types of memory that iOS tracks. Lets break each one of them down.
1) Wired - This is the most important memory. Anything stored with this designator can not be touched by the operating system. This memory contains the mission critical programs and data needed for the OS to survive.
2) Active - This is the second most important memory. This is where programs and data are being actively run but can be released from memory if the OS determines it is needed to keep the OS running.
3) Inactive - This is memory that was either Wired or Active but no longer in use. This memory can be freed at will by the OS with no repercussions to performance. BUT if the user decides to load an Application and it is still loaded in the Inactive memory segment, it will move it back to active instead of reloading from the flash drive. This is done to conserve battery.
4) Other - This is purely program data that is non critical. The OS decides if Inactive memory or Other memory is freed first before loading more programs or data.
5) Free - This is memory that hasn't been allocated to anything. About the only time you will see this number this large is after a reboot
One last note about the image above. It was taken approximately two minutes after the phone was hard reset. So we will consider that our starting point.
So lets test what happens when Tiger 2012 is loaded into memory.
And presto! All the numbers have changed. Since I didn't write iOS or this App I will have to do some theorizing for part of my explanation.
Wired - Odds are that memory jump is part of the graphics library API loading up.
Active - This is where the core of the application is loaded.
Inactive - I launched the App and then went to the first hole. Odds are the original memory for the menu system is stored here before it loaded the first hole.
Other - This is the bulk of where the 3D data and textures (graphics) are stored.
Free - We used up 142.5 Megabytes of memory to load Tiger 2012. BTW, the disk size that is used by this Application is 402 MB. So as you can see only part of the application was loaded.
So what happens when we kill the application? Drum roll please...
There you go. Conclusive proof that when you kill an application it does free up memory. But notice something? We didn't get it all back. The reason for that is simple. iOS kept core parts of Tiger 2012 in memory just in case the user relaunches the application. Which, as I mentioned earlier, helps with battery life.
BTW that second to the last sentence is the KEY to showing why some people insist that killing an app "doesn't free memory". And remember, I stated at the very beginning that the answer is "Maybe". Now to explain that answer which will clear up this myth and turn it all into facts.
Every application is basically a different size. Lets take the System Status application, that we used for this test, as an example. It is only 1.6 MB in size. So when it loads into memory it takes up a very small foot print. And when we force kill it, there is nothing to free up. It simply moves from Active to Inactive memory. This is what happens with every small application of this nature. And considering that for the longest time most apps could fit in 50 MB of space or less, that is why people insist nothing happens when you kill an app. Their observations are 100% correct because "Free Memory" wasn't affected. It wasn't until very large apps with large amounts of data could show that killing an app actually can and does free up some memory.
Next time someone insists that killing an app doesn't do anything for iOS, you can now point them to this thread. Because we just proved it does do something but what it does all depends on the application and how big it is.