Catch thread error due to low memory