Repository navigation
Fix asan leak in hip-samples - #12907
Merged
Merged
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The module is correctly unloaded after all uses and before context destruction.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes the HIP sample’s module resource leak by releasing the loaded code object before destroying its context.
Changes:
- Unloads the HIP module after its final use.
| File | Description |
|---|---|
projects/hip-tests/samples/0_Intro/module_api_global/runKernel.cpp |
Releases the loaded module during cleanup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
cjatin
approved these changes
Oct 12, 2026
systems-assistant Bot
pushed a commit
to ROCm/hip-tests
that referenced
this pull request
Oct 12, 2026
## Motivation <!-- Explain the purpose of this PR and the goals it aims to achieve. --> Fix an AddressSanitizer leak reported when the module_api_global HIP sample exits after loading a code object. ## Technical Details <!-- Explain the changes along with any relevant GitHub links. --> The sample loaded the module with hipModuleLoad but never released it. Added hipModuleUnload(Module) after the final module use. This destroys the underlying executable and releases the duplicated code-object URI. ## Issue Tracking <!-- Include a GitHub Issue and/or JIRA ID. Do not post any full JIRA links here. --> <!-- GitHub issue: ROCm/rocm-systems#1234 --> <!-- JIRA ID: EXAMPLECOMPONENT-1234 --> JIRA ID: ROCM-32204 ## Test Plan <!-- Explain any relevant testing done to verify this PR. --> Build module_api_global against an ASAN-enabled ROCm build and run it with: ASAN_OPTIONS="detect_leaks=1:symbolize=1". ## Test Result <!-- Briefly summarize test outcomes. --> The rebuilt sample exited with code 0, both validation checks printed PASSED!, and LeakSanitizer reported no leaks ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md. [rocm-systems] ROCm/rocm-systems#12907 (commit 0e449ad)
Contributor
TheRock Submodule Bump ActivityNewest first
|
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.
Motivation
Fix an AddressSanitizer leak reported when the module_api_global HIP sample exits after loading a code object.
Technical Details
The sample loaded the module with hipModuleLoad but never released it. Added hipModuleUnload(Module) after the final module use. This destroys the underlying executable and releases the duplicated code-object URI.
Issue Tracking
JIRA ID: ROCM-32204
Test Plan
Build module_api_global against an ASAN-enabled ROCm build and run it with:
ASAN_OPTIONS="detect_leaks=1:symbolize=1".
Test Result
The rebuilt sample exited with code 0, both validation checks printed PASSED!, and LeakSanitizer reported no leaks
Submission Checklist