Commit 8ef2c4be authored by Robert Maynard's avatar Robert Maynard
Browse files

TransferInfo doesn't leak when holding VirtualObjectTransferShareWithControl

When TransferInfo is given memory from VirtualObjectTransferShareWithControl
it doesn't have a bound function ptr for the destruction. In those cases
we need to make sure the HostCopyOfDevice is properly deleted, otherwise
we will cause a memory leak.
parent 33a30299
......@@ -44,8 +44,19 @@ void TransferInfoArray::releaseDevice()
this->DeviceId = vtkm::cont::DeviceAdapterTagUndefined{};
this->Device = nullptr; //The device transfer state own this pointer
if (this->DeviceTransferState == nullptr)
{ //When the DeviceTransferState is a nullptr it means that
//that the device and host share memory. In that case we need to free
//the host copy
//The DeviceTransferState holds ownership of HostCopyOfDevice so we only
//need to delete DeviceTransferState, as it will do the rest
this->DeviceTransferState = nullptr; //release the device transfer state
this->HostCopyOfDevice.release(); //we own this pointer so release it
void TransferInfoArray::releaseAll()
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