[GR-74145] C API raw allocation fixes and debugging helpers.#693
Merged
graalvmbot merged 6 commits intomasterfrom Mar 17, 2026
Merged
[GR-74145] C API raw allocation fixes and debugging helpers.#693graalvmbot merged 6 commits intomasterfrom
graalvmbot merged 6 commits intomasterfrom
Conversation
Correct GraalPy-specific raw allocator bookkeeping in obmalloc.c by charging only the realloc size delta, rolling back reserved bytes when malloc/calloc/realloc fail, and keeping the tracked native-memory total consistent with the actual libc allocation outcome. This fixes a real regression in GraalPy’s custom allocator path while preserving the existing diagnostic work for the NumPy periodic corruption investigation.
Teach GraalPy's raw native allocator to stamp each allocation with a fixed header magic and to verify that header on realloc and free before trusting the recorded size. This keeps the fast path lightweight, aborts immediately on corrupted or foreign headers, and makes allocator misuse fail at the point where the bad pointer first re-enters obmalloc rather than later in libc free().
Add two experimental GraalPy expert options that are threaded into the native C API option bitmask to enable heavier allocator debugging only when requested. With these options enabled, obmalloc can poison freed raw-allocation blocks and record a lightweight rolling history of raw allocation sites, while keeping the new diagnostics off the default path unless an investigation explicitly turns them on.
…o print symbolic names
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.
No description provided.