Generated-code allocator correctness - #45
Merged
Merged
Conversation
Greptile SummaryThe PR routes generated C-ABI lifecycle allocations through their configured allocator while preserving dependency-free Zig C-API generation by making native CDR allocator lookup opt-in.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported native CDR link dependency is now isolated behind an explicit opt-in flag, and ordinary Zig C-API generation emits no reference to that external symbol. Important Files Changed
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Several C-ABI code paths generated by the Zig and C++ backends hardcoded a fixed allocator (std.heap.c_allocator, plain new/std::unordered_map) instead of routing through the allocator an application actually configured (zzdds_create_factory_with_allocator, zidl_cdr_set_allocator). Under a real custom allocator — exactly what embedded/real-time consumers need — this caused genuine crashes (free(): invalid pointer, operator new() aborts). Found and fixed four confirmed, previously-undetected instances of this bug class during a broader design review of generated-type lifecycle and allocator sourcing.
Description of changes