Skip to content

[TRIVIAL] Review fixup for #8266: RAII malloc buffers in test_cuda_kernel#8290

Open
andralex wants to merge 1 commit intoNVIDIA:mainfrom
andralex:fix/stf-cuda-kernel-test-malloc-raii
Open

[TRIVIAL] Review fixup for #8266: RAII malloc buffers in test_cuda_kernel#8290
andralex wants to merge 1 commit intoNVIDIA:mainfrom
andralex:fix/stf-cuda-kernel-test-malloc-raii

Conversation

@andralex
Copy link
Copy Markdown
Contributor

@andralex andralex commented Apr 3, 2026

Follow-up from merged STF C API work: address review feedback on test_cuda_kernel.cu.

Wrap the host malloc buffers for the axpy test in std::unique_ptr<void, decltype(&free)> so REQUIRE failures cannot leak memory. Remove explicit free(X) / free(Y) at the end of the test.

Includes REQUIRE that allocation succeeded (get() != nullptr).

Made with Cursor

Use std::unique_ptr<void, decltype(&free)> for X/Y malloc buffers so
REQUIRE failures do not leak memory (review feedback).

Made-with: Cursor
@andralex andralex requested a review from a team as a code owner April 3, 2026 22:00
@andralex andralex requested a review from NaderAlAwar April 3, 2026 22:00
@github-project-automation github-project-automation bot moved this to Todo in CCCL Apr 3, 2026
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot bot commented Apr 3, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Review in CCCL Apr 3, 2026
@andralex andralex changed the title STF C test: RAII malloc buffers in test_cuda_kernel [TRIVIAL] Review fixup for #8266: RAII malloc buffers in test_cuda_kernel Apr 3, 2026

double* X = (double*) malloc(N * sizeof(double));
double* Y = (double*) malloc(N * sizeof(double));
std::unique_ptr<void, decltype(&free)> X_owner(malloc(N * sizeof(double)), free);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Can't these just be std::vector to avoid the custom logic here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants