C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available when compiling Bitcoin Core. On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS:
Alternatively, or in addition, debugging information can be skipped for compilation. The default compile flags are [direction]-g [/direction][direction]-O2,[/direction] and can be changed with:
Finally, clang (often less resource hungry) can be used instead of gcc, which is used by default: