If you are running out of memory, you may want to increase your swap memory.
swapon -s
if it is empty it means you don't have any swap enabled. To add a 1GB swap:
dd if=/dev/zero of=/swapfile bs=1024 count=1024k
mkswap /swapfile
swapon /swapfile