sudo su
apt-get install dphys-swapfile
2)ตั้งค่า swap file size ให้มากกว่าจำนวน ram 2 เท่า
echo "CONF_SWAPSIZE=512" > /etc/dphys-swapfile
dphys-swapfile setup
ถ้า PI มี แรม 512 MB RAM ตั้งค่า swapsize เป็น 1024.
3) สั่งให้ทำงาน
dphys-swapfile swapon
credite https://raspberrypi.stackexchange.com/questions/10363/how-to-prevent-raspberry-pi-memory-allocation-failure
