hornetsnest icon indicating copy to clipboard operation
hornetsnest copied to clipboard

cuFreeAux nullifies the pointer before invoking the cuMemFree

Open AnupNayakGitHub opened this issue 6 years ago • 0 comments

https://github.com/hornet-gt/XLib/blob/ded93b18da8bed55f1c96bb8e6e83e8078ffd969/include/Device/Util/SafeCudaAPI.cuh

template<typename T>
typename std::enable_if<std::is_pointer<T>::value>::type
cuFreeAux(const char* file, int line, const char* func_name, T& ptr)  noexcept {
    using R    = typename xlib::remove_const_ptr<T>::type;
    auto& ptr1 = const_cast<R&>(ptr);
   //Issue: The following two lines need to be switched
    ptr1 = nullptr;
   cudaErrorHandler(cudaFree(ptr1), "cudaFree", file, line, func_name);
}

This issue seems like fixed.

AnupNayakGitHub avatar Mar 20 '18 12:03 AnupNayakGitHub