I keep running into this crystal compiler bug and I currently see no workaround other than rebooting my box. I filed an issue here.
crystal$ crystal build main.cr
Unhandled exception in spawn:
fork: Cannot allocate memory (Errno)
0x55b5be: ??? at ??
0x11184c5: ??? at ??
0x1516fc8: ??? at ??
0x55e178: ??? at ??
0x0: ??? at ??
Has anyone else ran into this, and know how to fix it other than rebooting?