Handle out of memory errors