Swap Memory for Android (HTC Magic)

I flash my HTC Magic with MagicFusion ROM a few months ago. Recently I experience with the HTC sense need to reload quite often after I run a few program. I start to think about whether it is a problem of memory space or not. After I check the free memory with adb shell, I found out that I don’t have swap memory! This may be the program.

So, I download an app call “Swapper for Root” and added 200M of swap file in my ext partition (I had this partition a while without actually use it at all).

I have this set up for a few minutes now and tried to run a lot of apps that in the past cause sense to reload. So far, no reloading happen. It seems that the swap file has solved the problem (need more time to verify this, of course).

I tried to overload the system with as many servers, such as samba, VNC, etc., eventually it comes to a point where the sense need to reload. But, this time, the last server cannot be loaded neither. This means it actually reaches the upper limit of available memory before it break. And that is quite good enough for me because for normal operation, I will not load that many servers in the background.

Note: The about turn out to be not useful. What I then used was manually set up the swap space in sdcard.  With reference to http://androidcommunity.com/forums/f8/adding-swap-space-ram-to-g1-16325/ the following is the procedure (in shell commands):

dd if=/dev/zero of=/sdcard/swapfile bs=1024 count=204800
mkswap /sdcard/swapfile
swapon /sdcard/swapfile
free

The about command will set up a swap space of 200m (i.e., 204800=200*1024, thus total space will be 200*1024*1024=200m). The last commad “free” can be use to check whether the swap space is on or not.  Currently, 200m of swap space is what I am using.

However, using this method, each time whether the phone is rebooted, I have to run the “swapon” command each time.  I tried some of the auto start up apps but none of them seems functioning.

Advertisements

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