Add C23 free_sized/free_aligned_sized support#1
Merged
emeryberger merged 6 commits intomainfrom Mar 3, 2026
Merged
Conversation
Thread size/alignment info from C23 free_sized, C++14 sized delete, and macOS malloc_zone_free_definite_size through to allocators that can exploit it. Allocators opt in by providing free_sized() and/or free_aligned_sized() methods, detected via if constexpr. Existing allocators are unchanged — the fallback chain is: free_aligned_sized → free_sized → free. - HeapRedirect: new free_sized/free_aligned_sized with if constexpr detection - ALLOC8_REDIRECT: generates xxfree_sized and xxfree_aligned_sized - C++ sized delete operators now route through xxfree_sized/xxfree_aligned_sized - All platform wrappers updated (Linux, macOS, Windows) - gnu_wrapper.h: inline helpers with heap type detection for zero-overhead path - Version script: exports new symbols and C++14+17 sized+aligned delete manglings - DieHard/Hoard examples: add xxfree_sized/xxfree_aligned_sized stubs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GitHub Actions workflow that builds with tests and examples, runs ctest, verifies symbol exports, and tests LD_PRELOAD/DYLD_INSERT_LIBRARIES interposition on both platforms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
free_sized, C++14 sizedoperator delete, and macOSmalloc_zone_free_definite_sizethrough to allocators that can exploit itfree_sized()and/orfree_aligned_sized()methods, detected viaif constexpr— existing allocators are fully unchangedfree_aligned_sized→free_sized→freeWhat gets routed through the new functions
free_sized(ptr, sz)xxfree_sized(ptr, sz)free_aligned_sized(ptr, align, sz)xxfree_aligned_sized(ptr, align, sz)operator delete(void*, size_t)xxfree_sized(ptr, sz)operator delete(void*, size_t, align_val_t)xxfree_aligned_sized(ptr, align, sz)malloc_zone_free_definite_size(zone, ptr, sz)xxfree_sized(ptr, sz)free(ptr)/ aligned-only deletexxfree(ptr)(unchanged)Files changed (15 files, +242/-27)
allocator_traits.h,alloc8.h,new_delete.inc,new_delete.cppgnu_wrapper.cpp,gnu_wrapper.h,version_script.map.inmac_wrapper.cpp,mac_zones.cppwin_wrapper_detours.cpp*_alloc8.cppand*_redirect_win.cppCLAUDE.mdTest plan
cmake --buildsucceeds)ctestpasses (1/1 tests)DYLD_INSERT_LIBRARIES=libsimple_heap.dylib ./test_basic_alloc— all 13 tests passnm -gUshows_xxfree_sizedand_xxfree_aligned_sizedxxfree_sized(verified vianm)🤖 Generated with Claude Code