Added Sanity Check for out of memory

Just a quick check for out of memory