Skip to content

Commit

Permalink
cudf::detail::pinned_allocator doesn't throw from deallocate (#14251)
Browse files Browse the repository at this point in the history
Fixes #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.

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - David Wendt (https://github.com/davidwendt)
  - Divye Gala (https://github.com/divyegala)
  - Mike Wilson (https://github.com/hyperbolic2346)

URL: #14251
  • Loading branch information
robertmaynard authored Oct 6, 2023
1 parent 5d311ea commit 04e2cd6
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(dealloc_worked == cudaSuccess);
}

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

0 comments on commit 04e2cd6

Please sign in to comment.