deallocates costmap before resizing