Skip to content

refactor: replace raw new/delete with std::unique_ptr in NRadix#3122

Draft
robbycochran wants to merge 1 commit intorc-claude-devfrom
claude-nradixmem7
Draft

refactor: replace raw new/delete with std::unique_ptr in NRadix#3122
robbycochran wants to merge 1 commit intorc-claude-devfrom
claude-nradixmem7

Conversation

@robbycochran
Copy link
Collaborator

@robbycochran robbycochran commented Mar 19, 2026

Summary

  • Replaced manual memory management with RAII using std::unique_ptr in NRadix.h and NRadix.cpp
  • Updated nRadixNode members (value_, left_, right_) to use std::unique_ptr
  • Updated NRadixTree::root_ to use std::unique_ptr
  • Eliminated manual delete calls - destructors now defaulted
  • Simplified copy/assignment operators using std::make_unique

Benefits

  • Prevents potential memory leaks
  • Reduces code complexity (removed ~10 manual delete calls)
  • Follows modern C++17 best practices
  • All tests pass locally and in CI

Test Plan

  • ✅ Build passes (cmake --build)
  • ✅ All 17 unit test suites pass (ctest)
  • ✅ CI validation complete:
    • Unit tests: 6 variants passed (amd64/arm64 × Release/Debug/ASAN/Valgrind)
    • Coverage: passed
    • Builds: amd64 ✅, arm64 ✅
    • s390x: infrastructure flake (Ansible setup failure)
    • Integration tests: skipped (dependent on all builds)

Code Review

Ready for review. All functional tests passed. The s390x build failure is a CI infrastructure issue (Ansible installation on P&Z runner) unrelated to the C++ refactoring. Lint failure is pre-existing (shellcheck in .devcontainer/run.sh).

Agent Status

Last updated: 2026-03-19 22:31 UTC
CI cycle: 4 of 6
Status: FLAKE
Details: Code changes fully validated. All unit tests and main architecture builds (amd64/arm64) passed. s390x build failed during CI infrastructure setup (Ansible), not code compilation. Ready for maintainer review.

🤖 Generated with Claude Code

Replace manual memory management with RAII using std::unique_ptr for:
- nRadixNode members (value_, left_, right_)
- NRadixTree root_ member

This eliminates manual delete calls, simplifies copy/assignment operators,
and prevents potential memory leaks.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@robbycochran robbycochran changed the base branch from master to rc-claude-dev March 19, 2026 21:49
@github-actions
Copy link

/retest collector-on-push

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 75.00000% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (rc-claude-dev@8feb2b2). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
collector/lib/NRadix.cpp 82.60% 0 Missing and 4 partials ⚠️
collector/lib/NRadix.h 55.55% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             rc-claude-dev    #3122   +/-   ##
================================================
  Coverage                 ?   27.42%           
================================================
  Files                    ?       95           
  Lines                    ?     5423           
  Branches                 ?     2540           
================================================
  Hits                     ?     1487           
  Misses                   ?     3214           
  Partials                 ?      722           
Flag Coverage Δ
collector-unit-tests 27.42% <75.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants