• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE] Increase RAM using Swap File and Swap Partition

Search This thread

CarlDeanCatabay

Senior Member
Apr 17, 2012
577
5,145
Imus City
Increase RAM using Swap File and Swap Partition
NOTE:
I spent hours updating my guides and I don't ask you to press that THANKS button, be kind enough not to copy my guides to other forums. I know some noobs want to make a name on other forum boards... but hey, that's not an excuse!
Thread featured on XDA Portal :D
POSTED MAY 29, 2012 AT 4:00 AM BY POORCOLLEGEGUY
WARNING: This mod may degrade SD card life.
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
Before we start, lets do some reading . . .

RAM
What is RAM
Random Access Memory (RAM) is temporary data storage that the CPU uses during calculations. The more RAM a device has, the more calculated results the CPU can store - which means less time the CPU has to do the same thing over and over again. In other words, the CPU can check RAM to see if it has already made a particular calculation in the recent past. If it has, it can use the pre-computed results instead of wasting processing time recomputing the same calculation. In short, more RAM means a more efficient (and faster) device.
SWAP
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.
Step by Step Guide
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! :D)
Partition size: MIN: 256 MB MAX: 1024MB (1GB)
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 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 :p)
  • 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
How can I tell if swap is running?
Go to the terminal emulator - or open adb shell - and run 'free'.
If it looks like this (with zeros in the swap line), you do not have swap:
no-swap.jpg

If it looks like this (with anything other than zeros in the swap line), you do have swap:
swap-enabled.jpg

NOTE:
You need to turn off swap before you mount SD via USB, if you don't you will not be able to mount sd as swapfile is active and set to read only which will deny request to mount USB Storage.
Get Swapper2 here:
Thanks to kalhimeo who attached the the apk file on this POST or click this ATTACHMENT LINK to download.
Confirmed Working:
explodeaamir : great it works on my sgy with hybrid4.0
itz awesome
junior_montain : It worked perfectly on my galaxy y, together with perfect rom Creeds, swap and custom kernel, thanks
 
Last edited:

sheksbear

Senior Member
Apr 18, 2012
70
2
Swapper 2 (for Root users)
Elviss Kuštans
This app is incompatible with your TATA DOCOMO Samsung GT-S5360.

Now What??
 

CarlDeanCatabay

Senior Member
Apr 17, 2012
577
5,145
Imus City
Swapper 2 (for Root users)
Elviss Kuštans
This app is incompatible with your TATA DOCOMO Samsung GT-S5360.

Now What??

Google for the apk file. I'll try to upload later.




By Using this can we able to run gta3

Sent from my GT-S5360 using xda premium


Yes. :)




Is it works with stock kernel! or with creed 3.2 rom with its default kernel!:(

Yes it works on both stock and custom kernel. Swap file for stock and custom kernel. Swap partition only works with kernels that supports swap partition.

And since swapper handles swap file, the. It should also work for stock rom with super user access.

Sent from my GT-S5360 using xda premium
 

sidsaxena0

Member
Apr 14, 2012
15
1
delhi
Google for the apk file. I'll try to upload later.







Yes. :)






Yes it works on both stock and custom kernel. Swap file for stock and custom kernel. Swap partition only works with kernels that supports swap partition.

And since swapper handles swap file, the. It should also work for stock rom with super user access.

Sent from my GT-S5360 using xda premium

sorry bro but i think i am not understanding because as i know creed roms kernel and stock kernel have not swap support so how it will work with that!
 

CarlDeanCatabay

Senior Member
Apr 17, 2012
577
5,145
Imus City
sorry bro but i think i am not understanding because as i know creed roms kernel and stock kernel have not swap support so how it will work with that!

It works even with STOCK ROM and KERNEL because

Theoretically,
Swapper creates a swap file. Swapper then runs on on boot with superuser permissions. Since swapper can run on both stock and custom roms and kernels, then swapper can manage the swap file. If swap file can be managed, then sgy can use it.

The dev of swapper said swapper 2 needs root access so it can run and use swap. So as long as you can give super user permissions for swapper then it can use swap file.
 
Best and easy method for swap is using app called Swapper for root.
Do not need to create partions, format sd card, etc.
Only need a kernel support for swap like new merruk technology kernel.

°Download Swapper for Root app by GPlay.(its free)
°Run app.
°Tick Activate swap on boot.
°Set swap amount that you want.
°Save and wait for progress.

Goto terminal emulator and type
Code:
free
Check the Swap.


did that but no change and the swap feild iin emulator shows zero values
 

irfanbagus

Senior Member
Mar 12, 2012
307
498
stock kernel do not support swap and there's no way to make swap work without kernel support. make your memory bigger with swap will not make your android faster, it will be slower even if you have fast sdcard. android by design is not depend on concept of swap. it have own memory manager which will not working optimal if you enable swap.
 
  • Like
Reactions: Sagar_Patel

Top Liked Posts

  • There are no posts matching your filters.
  • 356
    Increase RAM using Swap File and Swap Partition
    NOTE:
    I spent hours updating my guides and I don't ask you to press that THANKS button, be kind enough not to copy my guides to other forums. I know some noobs want to make a name on other forum boards... but hey, that's not an excuse!
    Thread featured on XDA Portal :D
    POSTED MAY 29, 2012 AT 4:00 AM BY POORCOLLEGEGUY
    WARNING: This mod may degrade SD card life.
    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
    Before we start, lets do some reading . . .

    RAM
    What is RAM
    Random Access Memory (RAM) is temporary data storage that the CPU uses during calculations. The more RAM a device has, the more calculated results the CPU can store - which means less time the CPU has to do the same thing over and over again. In other words, the CPU can check RAM to see if it has already made a particular calculation in the recent past. If it has, it can use the pre-computed results instead of wasting processing time recomputing the same calculation. In short, more RAM means a more efficient (and faster) device.
    SWAP
    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.
    Step by Step Guide
    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! :D)
    Partition size: MIN: 256 MB MAX: 1024MB (1GB)
    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 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 :p)
    • 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
    How can I tell if swap is running?
    Go to the terminal emulator - or open adb shell - and run 'free'.
    If it looks like this (with zeros in the swap line), you do not have swap:
    no-swap.jpg

    If it looks like this (with anything other than zeros in the swap line), you do have swap:
    swap-enabled.jpg

    NOTE:
    You need to turn off swap before you mount SD via USB, if you don't you will not be able to mount sd as swapfile is active and set to read only which will deny request to mount USB Storage.
    Get Swapper2 here:
    Thanks to kalhimeo who attached the the apk file on this POST or click this ATTACHMENT LINK to download.
    Confirmed Working:
    explodeaamir : great it works on my sgy with hybrid4.0
    itz awesome
    junior_montain : It worked perfectly on my galaxy y, together with perfect rom Creeds, swap and custom kernel, thanks
    8
    For those who cannot download Swapper 2 from Google Play...

    Enjoy ;)
    5
    yup...repencis also have a kernel with swap support in one of their updates pack.

    btw, using swap might sounds fancy but please use it carefully. swap is common method used in computer device to enhance ram's performance. windows based computer is using same method called page file. nevertheless, as far as I know it almost not applicable for android devices. there are two reason of it.
    1. sdcard's r/w speed is much slower compared to hard disk. using swap in our sdcard in most cases won't increase our device's performance.
    2. sdcard have limited capability to be written. using swap means our system will write our sdcard a lot. it will significantly reduce our sdcard's life. it won't take longer than 3 months to find your sdcard corrupted if we're using a high quality sdcard, or even a lot quicker if we're using a standard class 6 sdcard. in my last test with samsung's sdcard, it takes less than a week.
    4
    Swapper 2 (for Root users)
    Elviss Kuštans
    This app is incompatible with your TATA DOCOMO Samsung GT-S5360.

    Now What??

    Google for the apk file. I'll try to upload later.




    By Using this can we able to run gta3

    Sent from my GT-S5360 using xda premium


    Yes. :)




    Is it works with stock kernel! or with creed 3.2 rom with its default kernel!:(

    Yes it works on both stock and custom kernel. Swap file for stock and custom kernel. Swap partition only works with kernels that supports swap partition.

    And since swapper handles swap file, the. It should also work for stock rom with super user access.

    Sent from my GT-S5360 using xda premium