Commit 9c4784a9 authored by Robert Maynard's avatar Robert Maynard

Transferring ownership from VTK-m to VTK doesn't leak memory now

Previously we would fail to properly transfer the correct delete
function to VTK and therefore would leak memory.
parent ed505610
......@@ -384,13 +384,16 @@ public:
ValueType* stolenMemory = reinterpret_cast<ValueType*>(handle.GetStorage().StealArray());
//VTK-m allocations are all aligned
const vtkm::Id size = handle.GetNumberOfValues() * Traits::NUM_COMPONENTS;
//stealing the array clears the delete function, so we need to get the function first.
//VTK-m allocations are aligned or done with cuda uvm memory so we need to propagate
//the proper free function to VTK
auto deleteFunction = handle.GetStorage().GetDeleteFunction();
ValueType* stolenMemory = reinterpret_cast<ValueType*>(handle.GetStorage().StealArray());
stolenMemory, size, 0, vtkAbstractArray::VTK_DATA_ARRAY_USER_DEFINED);
this->Data = array;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment