petrockblog/RetroPie-Setup — pull request #513 by joolswills (2014-12-11 02:45:50+00:00)
Title: Memory/swap changes

The idea of this lot is to

a) de-duplicate the existing code where we are adding a swap and then resetting it
b) move away from using dphys-swapfile configuration as we were not restoring the users original configuration.
c) make it a little more flexible / intelligent - so only try to add swap space if the user really needs it (if they have a raspbian set up with say 512M swap already, we won't add any more)

Some of the swap size / memory limit values might need a tweak, im running though some builds now on a 256M machine (with 128M allocated to gpu).

example call to turn on swap is

rpSwap on 256 240

which would add an additional 256M of swap if the total current ram+swap is less than 240M. Hopefully this should give us enough flexibility to add enough swap for low memory machines to build everything without unnecessarily adding swap for machine that don't require it.

please take a look through and give it a whirl anyway.