Skip to content

Add support for the new C23 deallocators - #988

Merged
godlygeek merged 1 commit into
bloomberg:mainfrom
godlygeek:c23_deallocators
Aug 7, 2026
Merged

Add support for the new C23 deallocators#988
godlygeek merged 1 commit into
bloomberg:mainfrom
godlygeek:c23_deallocators

Conversation

@godlygeek

Copy link
Copy Markdown
Contributor

Record calls to the free_sized and free_aligned_sized deallocators introduced in C23.

Instead of delegating to the original functions, we delegate to the free function for both. This is a legal implementation of these new deallocators, and simplifies our implementation since these functions may not always be available.

Closes #725

This is much of the code from #817, but updated to interpose the C23 deallocators even when Memray itself wasn't built with C23, and to test these changes through the memray._test_utils extension module instead of adding something to one of the hand written extension modules in our test suite.

@godlygeek
godlygeek force-pushed the c23_deallocators branch 4 times, most recently from 717d8cd to ff4c2c6 Compare August 6, 2026 22:30
@godlygeek
godlygeek requested a review from sarahmonod August 6, 2026 22:31
@godlygeek
godlygeek force-pushed the c23_deallocators branch 2 times, most recently from 17fc4e5 to d3ef6b5 Compare August 6, 2026 23:30
@codecov-commenter

codecov-commenter commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.39%. Comparing base (7a53953) to head (4a4ce8b).

Files with missing lines Patch % Lines
tests/integration/test_tracking.py 90.32% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #988      +/-   ##
==========================================
- Coverage   92.43%   92.39%   -0.04%     
==========================================
  Files         101      101              
  Lines       13160    13199      +39     
  Branches      474      477       +3     
==========================================
+ Hits        12164    12195      +31     
- Misses        996     1004       +8     
Flag Coverage Δ
cpp 92.39% <92.30%> (-0.04%) ⬇️
python_and_cython 92.39% <92.30%> (-0.04%) ⬇️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Record calls to the `free_sized` and `free_aligned_sized` deallocators
introduced in C23.

Instead of delegating to the original functions, we delegate to the
`free` function for both. This is a legal implementation of these new
deallocators, and simplifies our implementation since these functions
may not always be available.

Signed-off-by: Nana Adjei Manu <n.k.a.manu06@gmail.com>
Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution, @naamanu!

@godlygeek
godlygeek merged commit d6787da into bloomberg:main Aug 7, 2026
21 checks passed
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.

Intercept new free_sized and free_aligned_sized functions

4 participants