Ok, that's because the interaction between `free_host`, the Python
`CudaHostBuffer.__dealloc__` destructor and the C++
`CudaHostBuffer::~CudaHostBuffer` destructor is entirely unchecked, leading to
double-frees.
By the way, I've found it useful to apply the following patch:
```diff
diff --git a/cpp/src/arrow/gpu/cuda_memory.cc b/cpp/src/arrow/gpu/cuda_memory.cc
index a2455094..a52d7519 100644
--- a/cpp/src/arrow/gpu/cuda_memory.cc
+++ b/cpp/src/arrow/gpu/cuda_memory.cc
@@ -149,8 +149,8 @@ Status
CudaBuffer::ExportForIpc(std::shared_ptr<CudaIpcMemHandle>* handle) {
CudaHostBuffer::~CudaHostBuffer() {
CudaDeviceManager* manager = nullptr;
- DCHECK(CudaDeviceManager::GetInstance(&manager).ok());
- DCHECK(manager->FreeHost(mutable_data_, size_).ok());
+ DCHECK_OK(CudaDeviceManager::GetInstance(&manager));
+ DCHECK_OK(manager->FreeHost(mutable_data_, size_));
}
// ----------------------------------------------------------------------
diff --git a/cpp/src/arrow/util/logging.h b/cpp/src/arrow/util/logging.h
index 3286146c..fba66a83 100644
--- a/cpp/src/arrow/util/logging.h
+++ b/cpp/src/arrow/util/logging.h
@@ -91,7 +91,7 @@ namespace arrow {
#define ARROW_DFATAL ARROW_FATAL
#define DCHECK(condition) ARROW_CHECK(condition)
-#define DCHECK_OK(status) (ARROW_CHECK((status).ok()) << (status).message())
+#define DCHECK_OK(status) ARROW_CHECK_OK(status)
#define DCHECK_EQ(val1, val2) ARROW_CHECK((val1) == (val2))
#define DCHECK_NE(val1, val2) ARROW_CHECK((val1) != (val2))
#define DCHECK_LE(val1, val2) ARROW_CHECK((val1) <= (val2))
```
[ Full content available at: https://github.com/apache/arrow/pull/2536 ]
This message was relayed via gitbox.apache.org for [email protected]