Repository navigation
Conversation
AIX binds libc's internal calls to malloc when libc itself is linked, and they can't be rebound to a malloc defined in the program without rebuilding libc with rtl_enable. With unprefixed_malloc_on_supported_platforms, code in the executable uses jemalloc's malloc and free while libc keeps its own, so memory crosses allocators. std::fs::canonicalize, for example, frees realpath's result with free. On an AIX 7 host, with jemalloc unprefixed, strdup and realpath(path, NULL) didn't allocate from jemalloc, while malloc and free called from the executable did, and std::fs::canonicalize segfaulted on its first call. Add AIX to NO_UNPREFIXED_MALLOC_TARGETS, and reference IBM's documentation of this behaviour alongside the existing Rust commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Toby Lawrence <toby@nuclearfurnace.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Add AIX to prefixed-symbol targets jemalloc-sys/src/env.rs, CHANGELOG.md |
The target list adds AIX and an IBM AIX runtime-linking reference. The changelog records the allocator mismatch and canonicalize crash. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: madsmtm, busyjay
Merge Risk: 
Minimal · up to 77fff
-
The change is ready to merge; the referenced IBM documentation remains accessible and no actionable review risks remain.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title "jemalloc-sys: always use prefixed malloc on AIX" matches the main change. The PR adds "aix" to NO_UNPREFIXED_MALLOC_TARGETS in jemalloc-sys/src/env.rs, so AIX builds always use prefixed malloc symbols. The changelog entry and the commit rationale (allocator mismatch causing a crash in std::fs::canonicalize) support this reading. The title names the component, the platform, and the behavior change. It omits the crash rationale, which is acceptable for a title.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Welcome @tobz! It looks like this is your first PR to tikv/jemallocator 🎉 |
This PR adds
aixto the list of targets that don't support unprefixed malloc (NO_UNPREFIXED_MALLOC_TARGETS).When trying to use
jemallocon AIX as part of a work project, I encountered this issue and worked through it with an LLM, eventually leading to roughly the same conclusion/reproduction as has already been identified in the comments forNO_UNPREFIXED_MALLOC_TARGETS: certain standard library calls, such asstd::fs::canonicalize, were allocating memory through the system allocator, and then trying to free them throughjemalloc.It seems like this could be supported by using
rtl_enableas the commit message alludes to, but given that doing so requires manual intervention on behalf of the user, modifying shared objects in the process, and on the host running the application rather than the build host... it struck me as infeasible and that disallowing unprefixed mode for AIX was the simplest and most reasonable position to take.Summary by CodeRabbit
std::fs::canonicalizeto crash when freeing memory returned by libc’srealpath.