Added end memory and fixed release memory