This condition occurs when the compiler requires more memory than is currently available. It is not unusual for SSH sessions to drop when an out of memory error occurs, as you can tell from the output in this VM's dmesg:
Out of Memory: Kill process 3268 (sshd) score 2295 and children. Out of memory: Killed process 3269 (bash).
If you can't afford to take the machine down to add more memory and you have no space to create a swap partition simply add a swap file to temporarily boost the amount of virtual memory available. Replace 128 with the desired size of your swap file:
# cd / # dd if=/dev/zero of=./swap.img bs=1M count=128 # mkswap swap.img # swapon swap.img
Once you've finished, disable the swap file and delete it:
# swapoff /swap.img # rm /swap.img
I tend to have to do this a lot on my more resource-constricted VMs when I recompile gcc. It has been my experience that you should have at least 300MB of free memory to work with and that's often too much to justify permanently assigning to smaller VMs which can easily run in 128MB.