Currently, cudf:: methods returns pinned host memory allocations as rmm::device_buffers when we pass the PinnedMemoryResource as a device mr. In HostBuffer, we can not take the ownership of this, because rmm device buffer can not be released. rapidsai/rmm#2189
Workaround.
Add a unique_ptr<rmm::device_buffer> owner == nullptr class member to HostBuffer to handle such scenarios. Could be a bit consfusing to have a device buffer in HostBuffer though.