2

I'm curious if there's a way to create virtual memory for an Android phone. I have a 4gb mirco sd card in my phone.
Any ideas?

James Litewski
  • 461
  • 3
  • 8
  • 16

1 Answers1

5

Yes. You can partition your SD card and add a swap space to it; I have this on my G1. However, it's fairly complicated voodoo. (link is for G2, but instructions should be good for most phones; however, you should probably search XDA for whatever your phone is to be sure)

Swapper 2 from the market will do this for you, apparently. I haven't tried it myself, I use a custom ROM that has it built in.

Logos
  • 3,871
  • 1
  • 17
  • 24
  • Alright, I've never heard the term 'swap space' what is that? – James Litewski Nov 13 '11 at 18:34
  • 1
    @James Litewski: That is a partition used by the system for storing memory sections that have been long time not used which disburdens the main memory. It is the Linux equivalent of the Windows file pagefile.sys - if you know what that is. – Robert Nov 13 '11 at 18:48
  • I'm running a Mac.. Lol. – James Litewski Nov 13 '11 at 19:21
  • Swap space is what you asked about: virtual memory. As @Robert mentioned, on Windows it's called pagefile.sys; OSX uses empty space on the boot partition. Most Linux distros (of which Android is one) use a separate partition, called the swap partition.

    If you have a partitioning tool just pop your SD card into your computer, fire up the tool, shrink the FAT32 partition, and add a swap partition to the end (512MB is probably enough). If the preceding doesn't make any sense to you, you're probably better off just living with your phone as it is.

    – Logos Nov 13 '11 at 22:33
  • Even if you don't think the OP should do this, this post would be much improved with the "how". – Matthew Read Nov 15 '11 at 23:10
  • @MatthewRead: I did tell the OP how, both in the original post ("You can partition your SD card and add a swap space to it") and the comment just above yours ("If you have a partitioning tool just pop your SD card into your computer, fire up the tool, shrink the FAT32 partition, and add a swap partition to the end)." – Logos Nov 16 '11 at 10:33
  • Adding a partition doesn't automatically the OS will use it for swap. That's not even true for Linux, at least not generally. – Matthew Read Nov 16 '11 at 15:19
  • Ah... just realized that mine automatically picks up on swap space because of some ROM customizations. Edited my original answer though to include a nice little app I found that will create a swap partition for you. – Logos Nov 16 '11 at 15:55
  • Okay. I think I get it, sorta. A 'Swap Space' on Mac is just 'Free Space'? But without a Mod, it'd need that (or an equivalent) app? – James Litewski Nov 20 '11 at 07:30
  • Pretty much, yes, unless you want to root your phone and do it manually as per the G2 link. – Logos Nov 21 '11 at 11:38
  • Swapper 2 is a good tool for activating swap on rooted phones. However, be warned that due the way Android uses the memory (mostly by VMs using sweeping memory algorithms) swapping causes high IO load and if you swap to SD card, the overall latency will suffer a lot. I have found that having 5-10 MB swap is okay, though. The question is, are you hitting the lack of RAM bad enough to do the all the work for only 5-10 MB extra? Unfortunately, if you need much more, it's time to look for better hardware. – Mikko Rantalainen Jul 04 '14 at 08:42