Skip to content

Replace jemalloc bootstrap options with override-allocator#155617

Open
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:allocator-feature-rename
Open

Replace jemalloc bootstrap options with override-allocator#155617
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:allocator-feature-rename

Conversation

@Zoxc
Copy link
Copy Markdown
Contributor

@Zoxc Zoxc commented Apr 21, 2026

I want to make use of mimalloc on Windows so this renames jemalloc bootstrap options to override-allocator so we can reuse the same flag for this purpose.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

The Miri subtree was changed

cc @rust-lang/miri

Warning

If you are changing how CI LLVM is built or linked, make sure to bump
src/bootstrap/download-ci-llvm-stamp.

cc @jieyouxu

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @tshepang

@rustbot rustbot added A-CI Area: Our Github Actions CI A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 21, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@Zoxc Zoxc force-pushed the allocator-feature-rename branch from 0213b60 to 0946ab6 Compare April 21, 2026 20:29
@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the allocator-feature-rename branch from 0946ab6 to fc5ac40 Compare April 21, 2026 20:48
@rust-log-analyzer

This comment has been minimized.

Comment thread src/tools/clippy/src/driver.rs Outdated
@Zoxc Zoxc force-pushed the allocator-feature-rename branch from fc5ac40 to 11c97bb Compare April 21, 2026 21:30
Comment thread src/doc/rustc-dev-guide/src/building/optimized-build.md Outdated
@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Apr 22, 2026

Just renaming this doesn't make sense on its own; the config and the feature handling would have to be split. override-allocator would take the allocator to use, so it would become a string option, instead of a bool, but then we should still keep the individual features for the different allocators, i.e. jemalloc, mimalloc, etc.

@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Apr 23, 2026

The idea was to not expose control over which allocator gets used, so you couldn't specify mimalloc on Linux for example. Do we want to support more than one (on a specific target)?

@jieyouxu
Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned clubby789 and unassigned jieyouxu Apr 24, 2026
@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Apr 29, 2026

We'll want different approaches on Linux, macOS and Windows to override the C / Rust allocators. Having a single Cargo feature seems like it will result in less cfg! soup than having multiple, but a feature per allocator is possible too.

I'd like some feedback on the direction to take here so I can start working on macOS and Windows PRs on top of this.

@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Apr 29, 2026

I feel like there are specific things that we want to do per the selected allocator (JEMALLOC_SYS_WITH_LG_PAGE), and also that we will want to repeatedly run benchmarks with jemalloc/mimalloc/etc. on the various OSes, to periodically evaluate their perf. So I'd go towards a feature per allocator. That will also make it easier for us to switch between the allocators on individual OSes more easily.

On the other hand, we will either have to try to build all of the allocators on CI to ensure that they still at least build, or risk that the unused OS/allocator combos might go stale and break.

@Zoxc Zoxc force-pushed the allocator-feature-rename branch from 11c97bb to ff48fdf Compare April 30, 2026 08:11
@Zoxc Zoxc changed the title Rename jemalloc bootstrap options to override-allocator Replace jemalloc bootstrap options with override-allocator Apr 30, 2026
@Zoxc Zoxc force-pushed the allocator-feature-rename branch from ff48fdf to 6097bef Compare April 30, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants