Repository navigation
GH-55362: [C++] Fix jemalloc ReleaseUnused implementation - #55363
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the jemalloc purge-request change.
No open issues 🎉
What changed in this PR
Fixes GH-55362 by making the jemalloc-backed memory pool’s ReleaseUnused() issue a valid purge request instead of silently doing nothing.
Changes:
- Builds the
mallctlname using the numeric value ofMALLCTL_ARENAS_ALL. - Adds a debug assertion with an error message if purging fails.
| File | Description |
|---|---|
cpp/src/arrow/memory_pool_jemalloc.cc |
Corrects the jemalloc purge request and adds debug error checking and required headers. |
Review effort: Balanced
kou
approved these changes
Nov 3, 2026
kou
left a comment
Member
There was a problem hiding this comment.
+1
BTW, are you using jemalloc? If so, we may want to update bundled jemalloc.
Contributor
Author
No I'm not, I discovered this when testing |
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.
Rationale for this change
Makes ReleaseUnused no longer an unintentional no-op with Jemalloc.
What changes are included in this PR?
Correctly builds the
mallctlargument when callingJemallocAllocator::ReleaseUnused, and adds a debug-check of the error code.Are these changes tested?
Yes. I tested that without the fix, the
DCHECK_EQraised an error forJemalloc/TestMemoryPool/0.ReleaseUnused:With the fix, the tests pass.
I also ran an extra test that dirty pages were now released successfully and reduced to 0, when before they weren't. But I'm not sure this is worth committing as it could be affected by changes to jemalloc internals.
Are there any user-facing changes?
No.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by: