Typically I just return an error to the caller when memory fails.  I can add logging if you think it would be clearer.