yeah the ol memory is a real bitch on the pi...
did you do this:
sudo raspi-config - Advanced Options -> Memory Split -> set GPU memory to minimum (16MB)
??
if so then you will have to make a swap file. basic instructions for doing so
here though I strongly recommend trying the memory split first cause a swap file is going to slow compile down significantly.
Let me make sure I understand. How do I try a memory split? The above sudo command? If I run the above code I also need to add a swap file?