try to detect clang out-of-memory

It's rather annoying that Clang just prints a message with backtrace
and basically makes it look like a segmentation fault.