Catch memory allocation failures.