fixed bug, cuda runtime fail when free memory in a destructor