in a class, i declare some dev_ptr and cudaMalloc them, in the destructor function, if i need to do the ‘dev_ptr = nullptr’ after ‘cudaFree(dev_ptr)’, any help,thanks.
cudaFree
doesn’t guarantee any value for the passed pointer, so if you desire that it be nullptr
, you should set it that way in your destructor, after a successful return from cudaFree
.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.