checked deallocation of memory