virtual memory exhausted ...can not allocate memory

I am having Intel i7 processor with 4GB Ram.
After issuing make command I am getting following set of messages;To resolve
this problem I created an additional swap space of 2GB and then reissue the
'make' command but still got same set error messages;

graph-tool requires large amounts of RAM to compile. With a current GCC
version (4.8) on a 64-bit machine you need somewhere between 4-5 GB of
_free_ ram to compile it. With the clang compiler, however, you need
significantly less than this. So, if you are strapped on RAM, you are
probably better off using clang than GCC.