Skip to content

Replace jemalloc bootstrap options with override-allocator - #155617

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Zoxc:allocator-feature-rename
Jul 21, 2026
Merged

Replace jemalloc bootstrap options with override-allocator#155617
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Zoxc:allocator-feature-rename

Conversation

@Zoxc

@Zoxc Zoxc commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

View all comments

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

rustbot commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

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

rustbot commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

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

Kobzol commented Apr 22, 2026

Copy link
Copy Markdown
Member

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

Zoxc commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

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

Zoxc commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

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

Kobzol commented Apr 29, 2026

Copy link
Copy Markdown
Member

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
@Kobzol

Kobzol commented Jul 4, 2026

Copy link
Copy Markdown
Member

We should keep the old jemalloc option for at least half a year for backcompat, as we usually do with breaking config changes.

@Zoxc
Zoxc force-pushed the allocator-feature-rename branch from 6097bef to 23dbc53 Compare July 18, 2026 11:50
@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc labels Jul 18, 2026
@rustbot

rustbot commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Zoxc

Zoxc commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

I added an LLM written commit which adds back the jemalloc option and can be reverted after the grace period.

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one nit. Please also add a FIXME: remove in Q1 2027 comment on top of the jemalloc field in the bootstrap config.

Otherwise looks good to me.

View changes since this review

Comment thread src/bootstrap/src/core/config/toml/rust.rs Outdated
@Zoxc
Zoxc force-pushed the allocator-feature-rename branch from 23dbc53 to 011da65 Compare July 20, 2026 20:36
@Kobzol

Kobzol commented Jul 21, 2026

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 21, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 21, 2026
Replace `jemalloc` bootstrap options with `override-allocator`
@rust-bors

rust-bors Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 22599b1 (22599b18b5e77a2fd4f1d7b71d44319169e8e1a5)
Base parent: 87e5904 (87e5904f5eb6398af6b22eac2802c78934260c48)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (22599b1): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (secondary 3.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.9% [2.5%, 5.2%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 486.983s -> 488.14s (0.24%)
Artifact size: 391.82 MiB -> 392.48 MiB (0.17%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 21, 2026
@Kobzol

Kobzol commented Jul 21, 2026

Copy link
Copy Markdown
Member

Perf. looks good, thanks.

@bors r=Mark-Simulacrum,Kobzol

@rust-bors

rust-bors Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 011da65 has been approved by Mark-Simulacrum,Kobzol

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 21, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 21, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #155617 (Replace `jemalloc` bootstrap options with `override-allocator`)
 - #156225 (feat(num): improve error messages for `TryFromIntError`)
 - #159058 (implement #![feature(macroless_generic_const_args)])
 - #159435 (core: implement `Rng` for references)
 - #159471 (Make `Global` and `System` allocators unstably implement `const Clone + const Default`.)
 - #159590 (Remove some dead code)
 - #159636 (Improve some comments (and an error message))
@rust-bors
rust-bors Bot merged commit 3c4b83c into rust-lang:main Jul 21, 2026
14 checks passed
rust-timer added a commit that referenced this pull request Jul 21, 2026
Rollup merge of #155617 - Zoxc:allocator-feature-rename, r=Mark-Simulacrum,Kobzol

Replace `jemalloc` bootstrap options with `override-allocator`

I want to make [use of `mimalloc` on Windows](#138764) so this renames `jemalloc` bootstrap options to `override-allocator` so we can reuse the same flag for this purpose.
@rustbot rustbot added this to the 1.99.0 milestone Jul 21, 2026
@Zoxc
Zoxc deleted the allocator-feature-rename branch July 21, 2026 18:47
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jul 23, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155617 (Replace `jemalloc` bootstrap options with `override-allocator`)
 - rust-lang/rust#156225 (feat(num): improve error messages for `TryFromIntError`)
 - rust-lang/rust#159058 (implement #![feature(macroless_generic_const_args)])
 - rust-lang/rust#159435 (core: implement `Rng` for references)
 - rust-lang/rust#159471 (Make `Global` and `System` allocators unstably implement `const Clone + const Default`.)
 - rust-lang/rust#159590 (Remove some dead code)
 - rust-lang/rust#159636 (Improve some comments (and an error message))
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.