Skip to content

Commit

Permalink
cudf::detail::pinned_allocator doesn't throw from deallocate
Browse files Browse the repository at this point in the history
Fixes rapidsai#14165

The deallocate function is called by the `pinned_host_vector`.
Throwing from destructors is bad since they can't be caught,
and generally get converted into runtime sig aborts.
  • Loading branch information
robertmaynard committed Oct 5, 2023
1 parent b120f7e commit c39c688
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cpp/include/cudf/detail/utilities/pinned_host_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ class pinned_allocator {
* It is the responsibility of the caller to destroy
* the objects stored at \p p.
*/
__host__ inline void deallocate(pointer p, size_type /*cnt*/) { CUDF_CUDA_TRY(cudaFreeHost(p)); }
__host__ inline void deallocate(pointer p, size_type /*cnt*/)
{
auto dealloc_worked = cudaFreeHost(p);
(void)dealloc_worked;
assert(status__ == cudaSuccess);
}

/**
* @brief This method returns the maximum size of the \c cnt parameter
Expand Down

0 comments on commit c39c688

Please sign in to comment.