[TRIVIAL] Review fixup for #8266: RAII malloc buffers in test_cuda_kernel#8290
Open
andralex wants to merge 1 commit intoNVIDIA:mainfrom
Open
[TRIVIAL] Review fixup for #8266: RAII malloc buffers in test_cuda_kernel#8290andralex wants to merge 1 commit intoNVIDIA:mainfrom
andralex wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Use std::unique_ptr<void, decltype(&free)> for X/Y malloc buffers so REQUIRE failures do not leak memory (review feedback). Made-with: Cursor
Contributor
oleksandr-pavlyk
approved these changes
Apr 3, 2026
jrhemstad
reviewed
Apr 4, 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); |
Collaborator
There was a problem hiding this comment.
suggestion: Can't these just be std::vector to avoid the custom logic here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up from merged STF C API work: address review feedback on
test_cuda_kernel.cu.Wrap the host
mallocbuffers for the axpy test instd::unique_ptr<void, decltype(&free)>soREQUIREfailures cannot leak memory. Remove explicitfree(X)/free(Y)at the end of the test.Includes
REQUIREthat allocation succeeded (get() != nullptr).Made with Cursor