add control code for low memory warning