diff --git a/include/itkCudaDataManager.h b/include/itkCudaDataManager.h index 2a666e2..ddef2c8 100644 --- a/include/itkCudaDataManager.h +++ b/include/itkCudaDataManager.h @@ -162,6 +162,11 @@ class CudaCommon_EXPORT CudaDataManager : public Object void SetGPUDirtyFlag(bool isDirty); + /** Controls whether GPU memory should be released when dirty. On by default. + * When turning it off, one must call Free() to release the GPU memory. */ + void + SetReleaseDirtyGPUBufferFlag(bool release); + /** Make GPU up-to-date and mark CPU as dirty. * Call this function when you want to modify CPU data */ void diff --git a/src/itkCudaDataManager.cxx b/src/itkCudaDataManager.cxx index 31c8ba8..9b7bf65 100644 --- a/src/itkCudaDataManager.cxx +++ b/src/itkCudaDataManager.cxx @@ -124,6 +124,12 @@ CudaDataManager::SetGPUDirtyFlag(bool isDirty) this->Free(); } +void +CudaDataManager::SetReleaseDirtyGPUBufferFlag(bool release) +{ + m_ReleaseDirtyGPUBuffer = release; +} + void CudaDataManager::SetGPUBufferDirty() {