Ubuntu Trick: Out Of Memory When Compiling Source

This shit happens when i tried to compile Phalcon in my Ubuntu server:


...
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
..

Those lines means that my Ubuntu server/desktop demand more GB of RAM to compile. If it happens to you too, here's a trick that i wanna share with you.


sudo mkdir -p /var/cache/swap/
sudo dd if=/dev/zero of=/var/cache/swap/swap0 bs=1M count=256
sudo chmod 0600 /var/cache/swap/swap0
sudo mkswap /var/cache/swap/swap0 
sudo swapon /var/cache/swap/swap0

Those command above create a swap of 256 MB in /var/cache/swap/swap0. Swap helps the demanding of high GB of RAM by caching it to disk.

Continue to configure, make and install. Hope it helps you. Cheers.