free the memory after the computation