ensure memory gets freed