Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix GPU memory leak when creating texture object #614

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/rtkCudaUtilities.cu
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ prepareScalarTextureObject(int size[3],
static cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat);
cudaExtent volExtent = make_cudaExtent(size[0], size[1], size[2]);

// Allocate an intermediate memory space to extract the components of the input volume
float * singleComponent;
size_t numel = size[0] * size[1] * size[2];
cudaMalloc(&singleComponent, numel * sizeof(float));
CUDA_CHECK_ERROR;

// Copy image data to arrays. The tricky part is the make_cudaPitchedPtr.
// The best way to understand it is to read
// https://stackoverflow.com/questions/16119943/how-and-when-should-i-use-pitched-pointer-with-the-cuda-api
Expand All @@ -120,7 +114,7 @@ prepareScalarTextureObject(int size[3],
cudaMalloc3DArray(&threeDArray, &channelDesc, volExtent);
CUDA_CHECK_ERROR;

// Fill it with the current singleComponent
// Fill it
cudaMemcpy3DParms CopyParams = {};
CopyParams.srcPtr = make_cudaPitchedPtr(dev_ptr, size[0] * sizeof(float), size[0], size[1]);
CUDA_CHECK_ERROR;
Expand Down
Loading