Gadgetory


All Cool Mind-blowing Gadgets You Love in One Place

Does Android use more memory than iOS? – Gary explains

2017-02-02
hello my name's Gary Sims from annual authority now if you look at the latest generation of Android flagship smartphones for example the galaxy s7 the LG g5 the Google pixel they all come with 4 gigabytes of RAM and if you look at the equivalent in the iPhone line that the iPhone 7 has 2 gigabytes of RAM and the iPhone 7 it has 3 gigabytes of RAM in fact 3 gigabyte is the most of Apple I've ever put into one of their iPhones and if you go back to last year and the year before that you'll see this trend that Android phones always seem to have more memory than iPhones and this has led some people to say that's because Android uses more memory than iOS and therefore and with phones need to have more ran inside of them well is that true let me explain so first of all let's just clear it one thing here we're talking about random access memory here ramp okay that's the 4 gigabytes mode last it was 3 gigabytes we're not talking about internal storage which might be 16 gigabytes or 32 gigabytes or even 64 gigabyte which sometimes gets called memory because it uses what they call flash memory so therefore people mix it up so we're talking about RAM here random access memory not talking about internal storage so the RAM is used by the CPU to hold the operating system itself both iOS and Android stick in RAM and the data associated with running that operating system and then the apps you run also stay in the RAM while they're running and the data that those apps need and you need enough RAM to hold your printing system and hold your app so then you might ask yourself the question well how much free RAM is there on my smart phone now I'm forcing the term free RAM is not actually very very useful and that's because OS designers worked out but actually when you have a block of RAM but empty nothing and it's not being used at all that's not very efficient for example if you want to have lots of i/o lots of reason right from your flash disk it will be better if that reading and writing with cache that would improve performance so if you've got empty Ram well that Ram could be given over to using for caching and it's really good because actually in a moment if you need to run another app and it needs more around you can say okay let's abandon the cache it doesn't matter what's more important now is this app so it's not actually free ram in that it is not being occupied if you are both iOS and Android how much freer and they've got little tiny little bits like two megabytes or eight megabytes is on the tiny tiny bit but we have to use the term available Ram that's RAM that could be repurposed in a moment in an instant to loading up an app or to giving data space to an app now that's something quite different now for my testing I'm going to be using an iPhone seven and a nexus 5x and the reason for that is the iPhone 7 has two gigabytes of RAM and runs the latest operating system from Apple and the Nexus 5x has pretty good bytes of RAM and runs the latest version of Android now when you boot up the nexus 5x it has around about 840 megabytes of available ram when it boots are not free round with available ram when it boots up but when you boot up the iphone 7 it has around seven hundred and forty megabytes of available ram so we can see actually from the beginning actually Android uses less ram in a freshly booted system than iOS does so that's our first fact here that actually in a freshly booted system the Nexus 5x my iPhone 7 the iPhone 7 uses more RAM than the Android phone so when the device's boot there's no principal apps running there might be some background services running let's say checking your email but there's no actual apps running you haven't touched anything on the screen to say I want to run a particular app now when you do tap on an icon to launch an app it gets ready and from the flash drive into the RAM and it also will start asking for some memory to do the things that it wants to do and when that happens the amount of available RAM decreases because some of it has been given over to the new app now all modern-day operating systems including on the desktop and mobile phones use a thing called virtual memory now I haven't done a video about virtual memory if you want to see one then please do tell me in the comments but just to tell you quickly basically each app think is running in its own address space virtual address space and it doesn't know about the other app and the operating system is job is to allocate physical RAM related to what the app want in its virtual world is virtual address space now that means actually can be quite complicated because an app might ask for something might say hey I want a megabyte of RAM because I'm about to load a picture from the flash disk but the operating system might actually give it to it at that very moment it will wait because there will be some more time will go past and the app will start to actually load the data from the hard drive from the flash disk and then it likely start to write it to the RAM at that point your racism will say ok you can now actually have some physical RAM so an app might ask for something but it doesn't actually get it until actually start to write to it and actually what you might find is the operating system might not even give it a whole 1 megabyte of RAM if it only writes per half of that area of memory it might only physically allocate it half of that amount of memory that's the difference between virtual addressing and physical addressing and so therefore there's a difference between how much RAM as APIs are for its virtual address based on how much it's actually using inside of the physical RAM and that's known as the resident set size or maybe the real physical memory usage now you can actually on both the Android studio and on Xcode you can actually bring up some tools will show you how much physical Ram is being used by each particular app as what I've done is I've launched some various app on both the iPhone 7 and the Nexus 5x using the tools from the development change to study to see how much space is being given over in physical RAM to each of the different apps I think it's a variety of apps I've got like cleans like Crossy Road and Temple Run 2 and Microsoft Word and the YouTube app and I've run all of them to see how much space they occupy and the question before us is does Android use more RAM than iOS well here as results let's have a look so the results are a bit of a mixed bags we look at Crotty Road for example the Android version resident in physical realm is 383 megabytes and in iOS is 308 megabytes obviously a bit more use there bye-bye Android if you look at Temple Run in Android only uses 211 megabytes whereas in iOS it uses 364 megabyte and then subway surfers Star Wars fourth Arena they're pretty close particularly Star Wars for to rename just a couple of megabytes in it there if you look at YouTube that seems to use double in that case on Android Facebook up to the login prompt about the same Microsoft Word a bit bigger on Android and in fact if you add up all those numbers and draw an average Android phone users around 6 percent more than iOS device for the same range of programs so there is a slight memory increase on Android that cannot be denied but it's certainly not double you know or you know or like just just a huge different we are talking about the same actual relative size and that's actually view think about it that's going to be true isn't it because if you're loading up a game like crossing road it's got lots of graphics in it it's got lots of animations going on those graphics and animations and they take the same amount of space on an Android phone as they do on an iOS phone so really the idea that Android uses load more memory you know so that you need an extra gigabyte or something because of that actually isn't true at all which is actually no truth to that argument whatsoever and the other thing to notice here is that even games relatively complex games like star wars force arena or Temple Run 2 they're using 300 400 megabytes of RAM they're certainly not using 4 gigabytes or 3 gigabytes even that you get in the iPhone 7s so this really isn't the reason why there is extra RAM inside of these device it has very little to do with the actual running at now I'm sure there are some bigger apps up there I'm sure you can download them within one gigabyte one and a half gigabyte downloads that you can get I'm sure they are going to use more space but that isn't actually the problem here because you can see the Temple Run and Star Wars watering on crossroads could all run very comfortably in that for 700 or 800 megabytes of available RAM that there are on the 2 gigabyte versions of the Nexus 5x amber to gigabyte iPhone 7 so why is the extra RAM there's more to this story now we're all very used to using our phones in a multitasking fashion I might be using Gmail and Urkel checking some emails replying to it and then I might switch to a game to play crossing road for a few minutes then I might switch to my music app start listening to the music and then a notification comes in I might go back to Gmail now we what do we expect to happen this is really the questions about user experience for sure if I go back to Gmail I use Gmail lots of times during the day I want to be exactly as it was when I last used it but if I play crossing road and then switch out of it and then I don't go back to it for a week because it's family now a different game becomes my game of preference or I just haven't had any free time to do any gaming at all what do I expect crossing road to be when I come back after a week do I expect it to be exactly where I left it do I mind if it restarts from the beginning what do I expect well as I said this is about user experience now when you are in an app it's called the foreground app it's the app that you're interacting with it's the app is displaying on the screen but the moment you switch away to another app that app moves from the foreground into the background now how those background apps are treated is where we find the interesting part of this story now as I said there's only a certain amount of available ramp so when I start an app if I then start a second one is there are still enough available ram for both of them to be in ram at the same time if I start a third out is there still four five if there's still space that's the question that that has these operating systems have to cope with now on a desktop what happens when it runs out of memory and there's no more physical RAM it uses a protozoan of swapping and swapping basically means it takes the bits it doesn't need anymore because you actually haven't used that app for a week and it copies it to the hard drive not the app like the program that you install but all the memory that's using it just gets shifted out onto the hard disk that Ram becomes freed up and then the new app can go in there and then after a week if you do eventually switch back to that app well actually it can take it back from the hard drive find some more free RAM probably happens again through some more swapping and then it puts it back into memory and you can carry on running it now you can't do that on smartphones for lots of different reasons one is that writing to flash is actually quite slow the second is that actually you can wear out the flash because of all this constant reading and writing to it so iOS and Android don't take that approach of swapping out to flash this which is what you would get on a laptop or a desktop instead they have to do something different now what actually happens is is that on Android it will keep trying to load up into the into the available RAM and then if it hasn't got any more available Ram it will try to use a thing called compressed swap now compress what isn't like traditional shopping where it swaps to the hard drive or to internal storage which does is it takes the pages of RAM the blocks of RAM and said well if I compress these like like lift compression if I compress these and then put them into them Rama hey I actually make a free up 50% of the occupied RAM of that app we're using or or maybe even more and now I can use that Ram to actually put in my put in the new app so it uses this idea of swapping but not to external storage or internal storage it swaps to its own Ram but compressed now if it can't free up enough RAM by using the compression technique then Android says well I'm going to have to delete an app here for memory and it's got various algorithms that it uses let's say I haven't played cross the road for a week but it was still in memory basically Android will say well he hasn't used it for week it'll send a message to cross the road and say you're about to get deleted please save any state information that you want to save crossing road gets a a short amount of time to to save work where it is and then basically Android just killed it you're gone it just deletes it from memory removes it completely and that space that was used up by that app is now used for the new map that you just touched on tapped on to to load up now I did an experiment on the Nexus 5x if Iran for example Crossy Road it would use a certain amount of space I could then maybe run run to and that would run a third man on both app could stay in memory simulator and I could switch between them and exactly where I left off I could carry on running after Kara on fighting I could carry on doing everything I was doing inside though that if I tried to run a third app let's say Star Wars for Selena then at that point there wasn't enough free RAM and it couldn't get enough RAM using the compressed swapping so at that point one of the apps is killed off by Android to make space for the new app if I then switch back to let's say cross 0 which was if that was one of the least if I switch back to cross heroes it starts again get the hipster whale thing coming up and it reloads from the beginning because it was kicked out of of the memory so on the Nexus 5x with 2 gigabytes of RAM I thought I could run two games simultaneously switch between them games that occupies two three four hundred megabytes of RAM and then as a third one came along that would cause an app to be killed and that's using the low memory killer that's a system that you find that on Android when have enough memory it decides which apps to push out in the main memory and so that's a disadvantage or two gigabytes of RAM when you're running multiple apps that have large memory requires 300 400 500 megabytes then at some point other app has to be killed off to make space for the new app that you're running that's why if you've got three gigabyte phone or a 4 gigabyte phone actually the swapping between the apps the multitasking will you switch from one app to another becomes seamless because they're all held in memory at the same time now what about iOS it has exactly the same problems and in my testing I've seen iOS kid off at exactly the same way that Android does and you you go back to them and you tap on them again and they are there in memory they actually are have to reload from beginning I verified that using the tools that you get with Xcode so and iOS also kills off app so it doesn't have enough memory however this means streak of Android you find less often in Iowa because iOS manages to reduce the resident set size or programs that are already running too much lower levels for example we saw that crossing road might be using 300 something megabytes of RAM but actually want to switch it to the background I have seen iOS we call that 300 megabytes down 200 megabytes and then if you put more pressure on the system I've seen that whittled down to under 10 megabytes but yet when you switch to it it's able to instantly run from where it was before and the program camera doesn't we load you are switching to it now how i OS is doing that we don't know Apple doesn't give away the details or the internals of its system it could be using a clever paging system where for example the code that's running and the graphics that are running are automatically taken out of the memory because it knows iOS no they can find them on the hard disk again at a relevant time and when you switch to it it just brings all those back in now when you do switch click the resident peptide grows big again instantly it goes back up to 100 hundred and fifty two hundred megabytes in a flash in a moment so that data is still there it's probably getting it from the from the internal storage it could be using compression because that's now found in Mac OS OS 10 to ten point nine I think so that compression idea exists in Apple's thinking it could be doing that we don't know but I will say I'm not an athlete fan but I will say I am impressed by how iOS handles low memory situations for background apps so the reason why Apple have been putting less RAM inside of their phones is not because iOS needs less memory needs exactly the same memory as an Android does but when it in this background situation it's able to reduce the resident set size a physical Ram needed by background apps that are not running they just leave switched away from significantly now obviously where this falls apart is for example using an iPad and using the split screen idea of a split window then lead to a poorly completely both need men they need it now and that will cause the the system to run out of memory much quicker however I must say that the iOS handles low memory situations better than the Android does and what this means is that basically apple of said well we're not going to put an extra gigabyte of ram we're not gonna put an X to give our own we're going to rely on this technology that handles background parts whereas Android vendors are say basic we're gonna stick another gigabyte around now both are valid solution both are solutions to this problem maybe one is more elegant the other maybe the other is more advantageous to the consumer that's depending on your point of view but they are both solutions to the same problem what do you do you don't have enough RAM and Android is dealt with in one way and iOS has dealt with it in another way and that's fundamentally the difference between iOS and Android and RAM usage what my name is Gautam from Andhra thority I hope you enjoyed this video just a quick thing this is not a flame war I appreciate what Andrew is doing I appreciate what I RS is doing I appreciate personally having more RAM in my hand or phone because it's useful for that switching I also appreciate how iOS is handling that low Ram situation please it let's talk about the technology let's congratulate Androids it's congressionally Apple for the way they're handling this very complicated task of running multiple apps at the same time and then being there when we tap on them in an instant it's a very hard problem in software engineering to solve they've sold it in two different ways not a flame war let's just concentrate on the technology here now if you did enjoy this video please do give it a thumbs up also there's a get to subscribe to and royal authority YouTube channel you should download our and aura tea app because that would give you access to all of our news and features directly on your mobile phone but last but not least don't forget to go over to Android source comm because we are your source for all things Android
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.