memory allocation for HW2