Making the Most of the Android G1 and Magic’s Limited RAM

Android Logo

I've had  an HTC Magic (aka T-Mobile MyTouch, aka Google Ion) for close to a year now.  The phone was a gift from Google, handled out to me and the other 3000 attendees at Google I/O last year.  I like the phone's form factor. It's slim, light, highly pocketable and has a responsive capacitive screen that works well in sunlight.  But I've never used the Magic much until recently. The problem was the browser or more correctly the phone's woeful amount of available  RAM that caused the browser to perform poorly.

The Magic has, at most. 40 MB of free RAM at startup.  In typical use, RAM quickly drops to 20 MB or less and the OS starts killing background process to maintain stability and responsiveness. This low RAM issue affects the G1 (Dream) and most Magics (the ones with the 32B main board).  The 32A variant of the Magic shipped by some operators and most newer Android's have an extra 100 MB of RAM and, for the most part, are unaffected by these issues. To find out if your Magic is a 32A (good) or 32B (bad) see here.

In stock form the 32B Magic's browser seems unable to cache pages at all.  When hitting the back button, the browser rarely if ever retrieves the previous page from the cache, reloading  it from the server instead.  The same thing happens when switching between tabs, every tab change forces a page reload.  Switching between apps is also affected by the low RAM issue. If I switch from the browser to the Gmail app to read a new Email and then go back to the browser, the current page would have been cleared and will need to be reloaded.  Switching away from the browser and then back again also tends to completely close any tabs open in the background.

Not only is all this reloading a waste of time and resources, but it breaks some web apps by triggering a state change. For example, the RSS reader marks items as read on load and only shows unread items.  When the page reloads after returning from following a link in an item, Bloglines thinks that the previously loaded items have been read and doesn't display them.  On rapidly updating sites like a Twitter time line or a breaking news site, the unexpected page reload tends to make the user lose their place in the document because the page has changed when it reloads.

These unrequested page refreshes made the Android browser almost unusable for me. I ended not using the Magic much and mostly  using Opera Mini 4.2 for browsing when I did. Opera's  cache works properly and it rarely reloads a page. Plus Opera lets you save pages to the SD card or phone memory for safekeeping or offline reading.  But the phone's limited amount of RAM does affect Opera Mini too.  If  Mini is put in the background by opening another app, the OS generally kills it.  Unlike the Android browser, Opera 4.2 doesn't save any state information so that when it was reloads it's on the Speed Dial startup  page with browser history cleared.  Opera Mini 5 for Android is a little better in that it at least saves history when it's closed by the OS.

The low RAM issue is fixed in more recent Android phones.  The Hero, Droid/Milestone, Cliq and Behold II all have an extra 100 MB of RAM compared with the early models, as does the latest rev 2 version of the MyTouch 3G.  But that doesn't help users of the first Android phones.

Fortunately there is a solution.  There several things you can do to increase free RAM on the G1 and 32B Magic.  They are the "10MB hack" and the use of a swap file.  In order to use either of these you need to "root" your phone and install an alternate ROM.  I did both and was  amazed by the difference they made.

Here's what you need to do:

Root your phone and install Cyanogenmod's ROM: Warning, this will void your warranty. Things can potenially go wrong and "brick" your phone. However thousands of Android users have successfully rooted their phones and most (probably all) bricked phones can be recovered.  I'm not a rooting expert (I've only rooted one phone) so I'm not going to go into the details of rooting. Their are several excellent guides and tutorials on the web.  I used and recommend the ones on the CyanogenMod Wiki as they are through, frequently updated and well tested. There are a lot of steps, so take you time and read the tutorial carefully and completely before you do anything. Installing the latest CyanogenMod Rom (currently also gets you the Eclair (Android 2.0) browser with multi-touch, pinch zooming, double tap zooming and support for the HTML5 Database,  Application Cache and Geolocation APIs and the <video> tag.

Swapper Tons O' Tasks

Use a SWAP file: The excellent free Swapper utility in the Android Market makes this easy.  Simply install Swapper on your rooted phone, run it and hit the "Swap ON" button.  One caveat, you need a fast SD card for this to work.  I initially tried Swapper with regular speed 2 GB Kingston SD card that came with the phone and all it did was slow the phone down and made it unstable.  I replaced the card with a (shameless affiliate link) $10 Transcend Class 6, 4GB card from Amazon and the difference was amazing.  With the Class 6 card, enabling swap made my phone faster than stock and at least as stable and went a long way toward solving the browser cache issues.  While Swapper works pretty well out of the box, you can get even better performance by tweaking the settings a bit.  Everyone has different opinions on the ideal swap configuration. Based on trial and error, I found that using a 64 MB swap partition and a "Swappiness" setting of 60 seems to work best for me.  Setting up a swap partition requires some extra steps (Part of the Apps2SD setup,  explained here ).  If that sounds like too much trouble. you can get nearly as good results with a 64 MB swap file instead of a partition.

Install the 10 MB hack: The hack converts 10 MB of video memory into RAM.  While 10 MB isn't a lot it does help keep RAM above the 20 MB point where the OS starts killing off background processes. Unless you play 3D games you will never miss the video RAM.  If you are using swap, the extra RAM means swapping will occur less frequently.  Swap is slower than RAM so the less swapping, the faster your phone will be.  You can also use the 10 MB hack without a swap file and with a slow SD card.  The 10 MB hack is an addon to CyanogenMod ROMS. Absolutely Android has detailed instructions, including a  video and links to the hack files.  There is a different hack file for each CyanogenMod rev so  be sure you get the right one. The TasKiller image above shows over a dozen tasks running and still 25 MB of RAM free using a combination of swap and the 10MB hack.  With the stock setup, only run four or five tasks could run at a time and memory was constantly hovering around 20 MB.

Kill uneeded tasks: This is something you can do even on a stock, unmodified phone although ironically it's more of a necessity when you are using swap and/or the 10 MB hack. With a stock phone, the OS will only let a few tasks run at once. With swap enabled, you can easily get over a  dozen tasks running (image above) which will slow down the phone.  Do kill tasks you need to install a task manger utility. I like  Advanced TasKiller or Wing Tseng's Task Manager, both free apps that are available in the Market. They let you view running tasks and kill any you don't need. Killing all tasks before starting the browser improves performance and makes more memory available for caching. The image below left shows 39 MB free with Swype, Weather Bug and Hootsuite running. Before enabling swap and the 10 MB hack I only had about 20 MB free with the same tasks running,

TasKiller 39 MB Free. TasKiller Browser and Opera with 33 MB free!

With swap and the 10 MB hack, using the Android browser has become a pleasure. I can open several tabs and switch between them without reloading and can switch between the browser, Gmail and a Twitter client without worrying about my open browser tabs getting closed in the background. Opera Mini does not get terminated in the background either and the phone seems quicker overall. The image above show the browser (with two tabs open), Opera Mini 5,  HootSuite and Swype all running at once and still 33 MB free.  With the stock configuration running any more than two large apps like these at once was impossible.  Swap and the 10 MB hack have transformed my Magic and I've actually switched to using it as my main phone instead of my Nokia N95-3.

6 thoughts on “Making the Most of the Android G1 and Magic’s Limited RAM

  1. Properly I've been addicted to flashing, because of VZW not looking us to have access to the GPS on our phones. So I found the threads that tought me to flash my phone. Can even cook a little, but there are much greater chefs out there, so I'm content to toast their work. I at present am running Lioryte's 23529 assemble in the WinMo 6.five.1 on the Samsung Omnia with VZW. So now I've won the Behold 2 from Samsung, been playing with it for a couple of months.We've it rooted, I have BusyBox on it and aHome UI. looks good, functions great, but as well significantly bloatware. (The Cube and far more) Tried the Galaxy trick, very quick and total of useable memory. It's Android one.five pure. I would rather update the B2, not revert to Galaxy, and assemble from that. I will if that's the only way, I'll check new Odins to the B2 and do whatever enable I can to aid the B2 community advance the top quality of this telephone.I'm searching forward to helping make the B2 the greatest Android cellphone available.
  2. Very nice! Thanks for the tip! I was about to get a new phone because my G1 is getting extremely sluggish. Looks like I can get a more touches out of it :)

    Thanks again!
  3. Thanks for this share! I've been thinking about picking up one of the older gen Android phones, but the pretty crappy specs have pretty much held me back. Maybe I'll reconsider now =)

Leave a Reply

Your email address will not be published. Required fields are marked *