Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## codex-fix-borrow-array-discard #3322 +/- ##
==================================================================
+ Coverage 82.10% 82.11% +0.01%
==================================================================
Files 245 245
Lines 47612 47651 +39
Branches 41177 41216 +39
==================================================================
+ Hits 39090 39127 +37
- Misses 6617 6618 +1
- Partials 1905 1906 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the borrow-array conversion memory-leak fix.
No open issues 🎉
What changed in this PR
Fixes a memory leak in HUGR LLVM borrow-array conversion by freeing the borrow mask while transferring the element buffer to the ordinary array.
Changes:
- Frees the mask after verifying that no elements remain borrowed.
- Adds a JIT regression test that repeats conversion, access, and disposal 100 times, checking returned values, allocation counts, invalid frees, and outstanding allocations.
| File | Description |
|---|---|
hugr-llvm/src/extension/collections/borrow_array.rs |
Frees the mask during conversion and adds allocation-accounting regression coverage. |
Review effort: Balanced
Converting a borrow array to an ordinary array transfers the element buffer but leaves the borrow mask allocated. Free the mask after checking that no elements remain borrowed.
The borrow-array lowering was introduced in #2574.
Stacked on #3321.
Validation: the HUGR LLVM borrow-array tests pass, including a JIT allocation-accounting regression.