You might want to read some threads on the subject as it depends on what distribution your running on the Pi.
http://raspberrypimaker.com/adding-s...e-raspberrypi/
https://raspberrypi.stackexchange.co...wap-space#1605
To create swap file:
Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks. For example, the block size of a 64 MB swap file is 65536.
At a shell prompt as root, type the following command with count being equal to the desired block size:
dd if=/dev/zero of=/path/to/swapfile bs=1024 count=65536
Setup the swap file with the command:
mkswap /path/to/swapfile
To enable the swap file immediately but not automatically at boot time:
swapon /path/to/swapfile
To enable at boot see the first link.
If the system is using lots of swap i.e. check the output of the free command then adding more may not help.