By default the raspberry pi comes with just 100mb of SWAP size, which in some cases is a little to small. In order to increase it, or change it, just follow the next steps.
1. Stop de SWAP:
sudo dphys-swapfile swapoff
2. Change the size with the desired one by editing the file /etc/dphys-swapfile
In mai case: CONF_SWAPSIZE=1024
3. Reinitialize the SWAP:
4. Start the SWAP:
sudo dphys-swapfile swapon