Increase Available RAM in Android Using Swap

One of the worst things on certain budget-friendly smartphones is not having quite enough RAM. This normally isn’t a big deal for many users who use their phone for the practical purposes of calling people, sending texts, and checking email. However for people who do a lot more with their devices such as gaming and heavy app usage, the shortage of RAM may be a bit more limiting. Running out of RAM can cause a lot of problems such as app crashes and large-scale lag.

While you would have a hard time physically soldering on more RAM, users of the Samsung Galaxy Y , Y duos , or lower end devices can enable a swap file and partition thanks to a method written up by XDA Senior Member CarlDeanCatabay. This is similar to the pagefile used in windows, and while it isn’t nearly as fast as RAM, it may help certain apps that require a bit more breathing room .

The method is a little complicated, and requires you to repartition your SD Card. This method will also potentially lower the lifespan of your SD Card due to the higher number of write cycles.

What is SWAP : Swap is, in short, virtual RAM. With swap, a small portion of the hard drive is set aside and used like RAM. The computer will attempt to keep as much information as possible in RAM until the RAM is full. At that point, the computer will begin moving inactive blocks of memory (called pages) to the hard disk, freeing up RAM for active processes. If one of the pages on the hard disk needs to be accessed again, it will be moved back into RAM, and a different inactive page in RAM will be moved onto the hard disk (‘swapped’). The trade off is disks and SD cards are considerably slower than physical RAM, so when something needs to be swapped, there is a noticeable performance hit.
Unlike traditional swap, Android’s Memory Manager kills inactive processes to free up memory. Android signals to the process, then the process will usually write out a small bit of specific information about its state (for example, Google Maps may write out the map view coordinates; Browser might write the URL of the page being viewed) and then the process exits. When you next access that application, it is restarted: the application is loaded from storage, and retrieves the state information that it saved when it last closed. In some applications, this makes it seem as if the application never closed at all. This is not much different from traditional swap, except that Android apps are specially programed to write out very specific information, making Android’s Memory Manager more efficient that swap.

What you need:

  • MiniTool Partition Wizard for SD Card Partitioning
  • A MicroSD HC 4GB or higher class 6 or class 10
  • MicroSD HC Card Adapter
  • A card reader (if your pc doesn’t have card reader built in | USB Mount is not adviseable)
  • Swapper2 from Google Play Store [DOWNLOAD]
  • ADB Shell or terminal Emulator (to check if swap is activated)
  • Make sure you have BusyBox installed

How to create Swap Partition

Using MiniTool Partition Wizard

  • Plug in you MicroSD HC Card to your computer using the card adapter. (Do not use USB Mount)
  • Open MiniTool Partition Wizard and look for the card
  • Right Click on it and select Delete Partition
  • Click on Apply to Delete the Partition
  • Right Click on it again and select Create Partition

Set the partitions as follows:

1st partition:
Label: Android-SD
Create as: Primary
File System: Fat32
Partition size: as much as you want!

2nd partition:
Label: Android-EXT3 (2nd partition is for EXT which you can use for A2SD or Link2SD)
Create as: Primary
File System: EXT3 (be it a custom kernel or ROM with EXT4 support, use EXT3 still -play safe! )
Partition size: MIN: 20MB MAX: 512MB

3rd partition:
Label: (do not put anything)
Create as: Primary
File System: Linux Swap
Partition size: MIN: 32MB MAX: 1024MB(1GB) RECOMMENDED: 256MB

  • After creating partitions, click Apply to apply changes.

Using ClockWorkMod

  • Reboot to Recovery
  • Go to Advanced and Debugging
  • Select partition SD card and select the partition size that delights you

How to use Swap

For ROM Supporting SWAP scripts like CyanogenMod ROMs and AOKP ROMs , no need for swapper application , just make partitions as mentioned above and swap script will do the rest work, just try to see if it is working ,if not then follow this.

For Costom ROMs and AOSP ROMs For us to be able to use swap file or swap partition, we need to use Swapper2 which you can get from Google Play.

  • Download and Install Swapper2 (of course)
  • After installing, open Swapper2 and navigate to Menu > Settings

Swapper preferences: (for kernels that doesn’t have swap partition support)

  • Run swapper at startup (put a check)
  • Swap place: /sd card/swapfile.swp (you can place it in a folder if you don’t like a messy sd card structure)
  • Swap size: MIN: 10 MB MAX: 256MB RECOMMENDED: 32MB (choose any)
  • Swapiness: RECOMMENDED: 10MB SYSTEM DEFAULT: 60MB MAX: 100MB (choose any)
  • Safe unmount (put a check)
  • Safe remount (put a check)

Advanced preferences: (for Kernels that supports swap partition only)
Use swap partition (put a check)
Swap partition: /dev/block/mmcblk1p2

  • After setting preferences, press back and tap on “ON” to turn on swap. Reboot afterwards

UPDATE : AN IMPORTANT HINT:

Thanks to mr.bitman for drawing attention to this part:

For users with swap enabled kernel. When i tried swapper2 with three partitions (fat32/ext3/swap) and used your mountpoint (Swap partition: /dev/block/mmcblk1p2) swapper formatted on startup the ext3-partition (used by Link2SD or others) and I ended up with 2(!) swap-partitions and a crippeld system. Then i changed the mountpoint to: “/dev/block/mmcblk1p3″ (because it’s the third partition on the sd)..

 

How can I tell if swap is running?

Go to the terminal emulator – or open adb shell – and run ‘free’.
It looks like this (with anything other than zeros in the swap line), you do have swap:

in treminal emultor:

in adb shell :

About these ads

83 thoughts on “Increase Available RAM in Android Using Swap

  1. Hi..what if i had already used Link2SD and i only have 2 partition in my hard disk?how to backup apps that are already Link2SD?

  2. Thanks for the tutorial! But does not work for the latest version of Gingerbread, the 2.3.6. I’m using Galaxy W with the sd card and the internal memory and the external memory such as USB. By using the application, it gives error for execution because he can not create the swap file. Any suggestions?

  3. i can’t see any change happened in my cell in terminal emulator there was no such data related to swap plzzzzzzz help meeeee

  4. techno dous 1.0 and compact kernel
    instead of increasing ram by default ram has decreased to 289 mb earlier it was 290 mb
    what to do???????????????????????

  5. bro i have done all the settings correctly n tried n retried several times but i m getting error like >setting swappiness ok>turning swap off(file) FAIL>swapoff:cant stat ‘/sdcard/swapflie.swp’:No such file or directory.but bro i do have swap file in sd card and also put in different folder also to check but i thinks its kernel problem or is enable to on swap file do something.i m using micromax a50 (rooted) checked on both stock rom and jetmod 3.0 rom.help bro i have only 70mb ram for moderate usage.thanks

  6. hey , i have galaxy y duos and using tecnoduos 1.o , rooted

    i have done all the things you told about, busy box installed, swapper 2 installed, miniwizard etc etc..
    but i configured the swapper as instructed …and when i switch it on ..in the low display its says FAIL…blah blah,,,
    and then i used terminal emulator to see that swap status….it has all 0s in the swap line…please help
    thanks

  7. When i write “free” in the terminal it show “not found” i have real ics v6 on sony Ericsson live With Walkman. Please help!

  8. i have 8 gb memory card if i use link to sd and increase internal memory and also increase ram would there will be a chances of burning of sd card i have increased internal memory 1 gb and ram 200 mb plzzz reply fast im waiting

  9. I’m in a Jiayu G2 512mb RAM so I really need swap… done all the instructions, after pushing on I recieve 2 messages:

    ->turning swap off(file) FAIL
    ->swapoff: /sdcard/swapfile.swp: function not implemented

    ->Enabling swap off(file) FAIL
    ->swapoff: /sdcard/swapfile.swp: function not implemented

    Really appreciate the help

  10. You should add a hint for users with swap enabled kernel. When I tried swapper2 with three partitions (fat32/ext3/swap) and used your mountpoint (Swap partition: /dev/block/mmcblk1p2) swapper formatted on startup the ext3-partition (used by Link2SD or others) and I ended up with 2(!) swap-partitions and a crippeld system. Then i changed the mountpoint to: “/dev/block/mmcblk1p3″ (because it’s the third partition on the sd) and everything works fine. Nice tutorial, thnx

  11. Is this really working. Say some detail. It’s a difficult way to get it . Any easy way?
    I’ll really thankfully to you.

  12. Good Day!
    My phone is sony xperia neo L is it possible to use swapper2?
    and i have clockworkmod recovery is it required to install cyanogen mod?..
    and lastly my sd card has a capacity of 16 GB can you give me a recommended size of partitioning?
    Thank you! and hopefully you can help me…
    God bless!

    • ya it is possible, no cyanogen is not must required for it , and partition you can do by your self but size of swap=size of ram is recommended and of ext2 then 512 will be ok.

  13. Thanks for your instruction!
    you didn’t mention about how to root android
    without root I think its impossible
    if any one knows how to root android 4.0 pleas let me know
    thanks

    • Rooting a particular device sometimes need device specific method ,so its not possible to make guide to root all device , then also you can tell your device or request for guide , i’ll try to provide it

  14. Hi Jinesh, I am using a Xolo A500 smartphone. Could you please provide me the rooting procedure for my phone? Also, will the swap work on my stock ROM after rooting? Please help me out

  15. Hi, Jinesh soni I have Galaxy S3 and in my ph. I gb ram 16 Gb inbuilt and i have 32 Gb card now you please tell can i upgrade my ram and maximum how much means can i upgrade one GB more……..

  16. hi jinesh I’m using SPICE stellar xtacy Mi-352, and has 8 gb class 10 micro sd card..can it be possible to increase the RAM & Internal memory…confused abouit the procedures. kindly help me..

  17. Hi Jinesh,

    Can I use Rescue Root for rooting my Xolo A500. It looks to be satisfactory, but it is still in beta version with no support for Android 4.0.4 yet, but it has been promised that 4.0.4 will be supported very soon. So can I go forward and use it? What is your opinion?

  18. HI I am using micromax a87 but when i have finished doing the partitions no changes i have seen in it and when i open my link2sd it wants partition and when i select one it displays if you have root acess so click on grant or acess and i was also unable to root my phone and i also did not get clockworkmod so please help me.

  19. sir, when i completely follow your instruction theres an error when i turn the swapper ON
    it says :
    ->turning swap off(file) FAIL
    ->swapoff: /sdcard/swapfile.swp: function not implemented

    ->Enabling swap off(file) FAIL
    ->swapoff: /sdcard/swapfile.swp: function not implemented

    can you help me with this sir? im using samsung galaxy pocket rooted with busybox installed

  20. I am unable to find the USB drivers for my Xolo A500. Could you please help me by providing them? Can anyone else also please help?

  21. hey friend
    i’m siddhant i had followed all the processes but swapping was failed.
    message is shown like this:-
    ->turning swap off(file) FAIL
    ->swapoff: /sdcard/swapfile.swp: function not implemented

    ->Enabling swap off(file) FAIL
    ->swapoff: /sdcard/swapfile.swp: function not implemented

  22. For partitioning the SD card can we use the recovery mode method and for increasing RAM can we do the following.
    ◦For increasing your device RAM you have to firstly download “Swapper for Root” from Google Play Store.
    ◦Open the app that you have downloaded now for RAM and select the amount of RAM you want to increase.
    ◦Let the application to create the .swp file and you have increased the ram you wanted.

  23. Buddy I have Huawei Y210d
    I wanted to increase ram but my kernel does not support swap…
    So anyway I can get it done???

  24. hello, i have a lg optimus me (a.k.a. p350) android 2.3.7, cyanogenmod-7, kernel 2.6.32.9,
    i cant install swapper2 on my device, is there any alternative way for me to do this on my device

  25. hi Jinesh,

    good article.
    however, i’d like to try on my phone.
    do you think is it possible for kernel 3.4.0 #1 SMP PREEMPT?
    an early reply is much appreciated. Thx

  26. please tell me. i have a samsung galaxy y s6102. i have rooted it and i have a 4 gb sd card. can i increase my ram?

  27. Hello
    I have a spice stellar xtacy and i am unable to root it. I have used all methods like one click root, unlock root, root interceptor, frameroot, z4root etc but no use. Please help.

  28. I like the helpful info you provide for your articles.
    I’ll bookmark your weblog and take a look at again right here regularly.
    I’m fairly certain I will be told many new stuff
    right here! Good luck for the following!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s