Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Phalcon - Virtual memory exhausted: Cannot allocate memory

Tags:

When I try to compile Phalcon, I get an error:

virtual memory exhausted: Cannot allocate memory

I am running the following commands

git clone --depth=1 git://github.com/phalcon/cphalcon.git 
cd cphalcon/build 
sudo ./install

I have a VPS with 1GB RAM

like image 552
Nikolaos Dimopoulos Avatar asked Apr 02 '14 18:04

Nikolaos Dimopoulos


2 Answers

Add more swapfile may help. I met this problem when tried to compile YouCompleteMe for vim, solved it by adding swapfile.

https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-14-04

like image 118
Hunger Avatar answered Sep 25 '22 23:09

Hunger


It seems GCC is allocating a lot of memory, check this

https://web.archive.org/web/20141202015428/http://hostingfu.com/article/compiling-with-gcc-on-low-memory-vps

Stopping as many services as possible (Apache, MySQL etc.) will free up more memory, and Phalcon will compile. Worst case scenario you will need to increase the memory of your virtual box.

Thanks to @AndrewD for providing the link that works.

like image 41
Nikolaos Dimopoulos Avatar answered Sep 25 '22 23:09

Nikolaos Dimopoulos