rust-lang / rust-lang/rust

1.98 memory usage regression

Open
#161,660 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-compilemem P-high regression-untriaged T-compiler T-types
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Overall memory requirement for compiling our espresso-node crate roughly doubles from 10GB to 20GB from 1.97.1 to 1.98. The issue was discovered because our CI runners have 16GB RAM and fail to build on 1.98

Example: https://github.com/EspressoSystems/espresso-network/actions/runs/32478615863/job/96760043575

Exit code: 143

LLM assisted bisection yielded #156417 as the cause. I can provide more of the LLMs outputs if useful.

Code

I tried this code:

git clone https://github.com/EspressoSystems/espresso-network
cd espresso-network
RUSTC_BOOTSTRAP=espresso_network cargo rustc -p espresso-node --lib -- -Ztime-passes

I expected to see this happen: compiles with roughly the same memory requirement as 1.97.1

$ RUSTC_BOOTSTRAP=espresso_network cargo rustc -p espresso-node --lib -- -Ztime-passes
..
time:   0.001; rss: 1372MB -> 1372MB (   +0MB)	monomorphization_collector_root_collections
time:  57.142; rss: 1372MB -> 3067MB (+1695MB)	monomorphization_collector_graph_walk
time:   3.256; rss: 3061MB -> 3344MB ( +283MB)	partition_and_assert_distinct_symbols
time:  71.973; rss: 1358MB -> 3291MB (+1933MB)	generate_crate_metadata
time:   0.000; rss: 3291MB -> 3291MB (   +0MB)	find_cgu_reuse
time:  16.406; rss: 3291MB -> 3838MB ( +547MB)	codegen_to_LLVM_IR
time:  16.450; rss: 3291MB -> 3838MB ( +547MB)	codegen_crate
time:   0.000; rss: 3839MB -> 3839MB (   +0MB)	incr_comp_persist_dep_graph
time:  14.824; rss: 3666MB -> 3834MB ( +169MB)	LLVM_passes
..

Instead, this happened: Uses significantly more memory on 1.98

$ RUSTC_BOOTSTRAP=espresso_network cargo rustc -p espresso-node --lib -- -Ztime-passes
..
time:   0.001; rss: 1345MB -> 1345MB (   +0MB)	monomorphization_collector_root_collections
time:  65.445; rss: 1345MB -> 14974MB (+13629MB)	monomorphization_collector_graph_walk
time:   3.033; rss: 14987MB -> 15276MB ( +289MB)	partition_and_assert_distinct_symbols
time:  78.328; rss: 1350MB -> 15220MB (+13870MB)	generate_crate_metadata
time:   0.000; rss: 15220MB -> 15220MB (   +0MB)	find_cgu_reuse
time:  16.254; rss: 15220MB -> 17343MB (+2123MB)	codegen_to_LLVM_IR
time:  16.256; rss: 15220MB -> 17344MB (+2124MB)	codegen_crate
time:   0.000; rss: 17344MB -> 17344MB (   +0MB)	serialize_dep_graph
time:  18.253; rss: 15418MB -> 6046MB (-9372MB)	LLVM_passes
..
Version it worked on
rustc 1.97.1 (8bab26f4f 2026-07-14)
binary: rustc
commit-hash: 8bab26f4f68e0e26f0bb7960be334d5b520ea452
commit-date: 2026-07-14
host: x86_64-unknown-linux-gnu
release: 1.97.1
LLVM version: 22.1.6
Version with regression
rustc 1.98.0 (88d9e12ae 2026-08-18)
binary: rustc
commit-hash: 88d9e12ae178fab0fb5cc050a94da85685d449ea
commit-date: 2026-08-18
host: x86_64-unknown-linux-gnu
release: 1.98.0
LLVM version: 22.1.8
Backtrace

no crash

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the regression with the provided cargo rustc command on Rust 1.97.1 and 1.98.0, then compare the -Ztime-passes output, especially monomorphization_collector_graph_walk. Read the bisection result in issue #156417 for the suspected cause. Done means the espresso-node crate no longer requires roughly 20GB on 1.98 while retaining the relevant compiler behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.