
There are a lot of people arguing about how memory management works on iOS (and OS X, also, because they use the same technique), so I thought I would try and outline it as best as possible and my view as a iOS developer
As memory get used, it's divided into categories: Active Memory, memory currently being used by an application; Inactive Memory, memory not currently being used by an application and is therefore inactive, this memory is also paged to disk; Wired Memory, memory being used by iOS or other frameworks called by an app; Free Memory, memory not used by the application or iOS, virtually free of use.
When you launch an app, it gathers memory from either the free memory pool OR the inactive memory pool (which I'll describe in a little) and pulls it into the active memory pool for itself.
Whenever you leave a program (assuming that it does not have any multitasking-frameworks written in it) iOS automatically suspends it's active memory, shoving it into the inactive memory pool.
Inactive memory is the memory of other applications that have been previously opened then closed, or chunks of memory that an application is not actively using. This is why applications are faster to launch after you've previously opened them and Apple was easily able to add the "quickly resuming applications where you left off"-style multitasking to apps without requiring developers to rewrite anything; it was derived directly from OS X's memory management techniques. The difference between iOS and OS X, however, is that instead of paging inactive memory to disk whenever an app needs more than it currently has in it's own section of inactive memory and the available free memory, iOS just removes the oldest inactive memory (without saving it to disk), and gives what is needed to the requesting App and giving the rest back to the free memory pool.
To prevent this killing of apps too often, iOS uses a memory management technique (which is built into all apps, you're forced to use memory management instead of garbage collecting in iOS) for all of its apps. Basically, memory management works like this: App needs 10kb of memory, so it asks iOS for 10kb of memory, and iOS serves it 10kb of memory. When the App is done with the 10kb of memory, it HAS TO MANUALLY release the memory back to iOS, which then controls that memory. If this is done incorrectly, memory leaks spring, the app begins to DEVOUR memory, iOS is unhappy and kills the app. Because of this method, iOS apps rarely take up more than 50-75mb (Even for the iPad or OS X!). Don't get me wrong, there are intensive apps that take up more (like Safari), but that is very rare. Apple is strict about this in app creation.
That said, 512mb of memory is way more than enough, even for the iPad. While you'll notice a slight change in memory intensive applications such as Safari (which is very memory intensive because it decompresses Javascript, renders HTML, and caches images to memory) or iBooks (when rendering large PDF's and images), the biggest benefit will be multitasking, as more applications can be stored in the memory without having to remove them.
Currently, 256mb of memory is more than enough to run most any application (aside from running into problems with a few specific problems such as Safari with multiple tabs [which, Safari kills large and older tabs on its own when iOS tells it that it needs to reserve memory, often when loading other significantly large tabs]).
1gb of RAM would be a waste of resources and money in iOS land, for the time being.
I do not know the technology behind, but I never found the Macs I have used to be inadequate for my purpose, even when I used them for years, even when I have multiple applications (Pages, iPhoto, Numbers, Fetch, Editors, Previews, etc.), and several dozens of browser windows open (sometimes using Safari, Firefox, Opera, Chrome, Netscape, Camino when I am checking layouts) with a gazillion of files open.
The first time I used an iPad, I thought it may not load my site because it lags a few seconds in my latest MacBookPro, but it loaded even much faster. Even with the smaller screen size (in portrait position), I was surprised how the resized whole page was "clear" and quite readable. There were so many things I found surprising for coming from the first generation iPad.
The other thing that I was amazed with are the "diskspace" sizes of the applications -- they seem to be much less space usage than what I would have expected.
One thing I am curious about, there used to be a function(?) called "Rebuild" I think in pre-OSX Macs. If memory serves me, it was supposed to deal with rebuilding more efficient storage of the contents of a file in the memory storage. This function is no longer in OSX?
CGC






