Repository: rust
Issue: OOM/surprising memory consumption with Rust 1.72
Labels: A-LLVM,P-high,T-compiler,regression-from-stable-to-stable,O-wasm,I-compilemem,C-bug

I was using trunk serve in a yew app, 

```
Caused by:
  process didn't exit successfully: `/home/amiya/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name shivarthu_client --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=80 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=2fb06b1d42d3f1a3 -C extra-filename=-2fb06b1d42d3f1a3 --out-dir /home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps --target wasm32-unknown-unknown -C incremental=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/incremental -L dependency=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps -L dependency=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/debug/deps --extern futures=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libfutures-9238ff4e317c3aac.rmeta --extern gloo=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libgloo-60896b1ae6a42d49.rmeta --extern gloo_storage=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libgloo_storage-a6fdc8399e55cb57.rmeta --extern gloo_timers=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libgloo_timers-64084cd68bafd650.rmeta --extern hex=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libhex-5e7bde3579f1f1a6.rmeta --extern js_sys=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libjs_sys-e590384aba116f81.rmeta --extern json=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libjson-a742c24145fa9768.rmeta --extern jsonrpsee_core=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libjsonrpsee_core-7b87c5a28395f6a9.rmeta --extern jsonrpsee_wasm_client=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libjsonrpsee_wasm_client-fb5fb48c5225dd1b.rmeta --extern magic_crypt=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libmagic_crypt-4ac60596f6303e71.rmeta --extern codec=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libparity_scale_codec-caa20e3ef61bd74b.rmeta --extern pulldown_cmark=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libpulldown_cmark-2f215fdb4fc370a2.rmeta --extern rand=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/librand-6a1cd1454f5f2ed3.rmeta --extern regex=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libregex-0ea9999c5fd0a43a.rmeta --extern serde=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libserde-77e7121d7f29378b.rmeta --extern serde_json=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libserde_json-0cde3d295cb3341b.rmeta --extern sp_core_hashing=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libsp_core_hashing-4abbca5b36da070b.rmeta --extern stylist=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libstylist-8bf6dde19155c506.rlib --extern subxt=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libsubxt-85e91451cd672d8b.rmeta --extern subxt_signer=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libsubxt_signer-30a7c737b8121a1e.rmeta --extern bip39=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libbip39-a9da80cbe86f172d.rmeta --extern tracing_subscriber=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libtracing_subscriber-cc770f7b154a03a5.rmeta --extern wasm_bindgen=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libwasm_bindgen-238c011dda2fc36f.rmeta --extern wasm_bindgen_futures=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libwasm_bindgen_futures-f9e3a36327e867b0.rmeta --extern web_sys=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libweb_sys-bd30a5ab258c4098.rmeta --extern yew=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libyew-1f77145103937fbf.rmeta --extern yew_hooks=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libyew_hooks-5af603117099c85b.rmeta --extern yew_router=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libyew_router-8ff113f54e98b6bc.rmeta --extern yew_icons=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libyew_icons-f15f701dda4c112c.rmeta --extern yewdux=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/deps/libyewdux-2543950b3ee67c71.rmeta -L native=/home/amiya/Documents/workspace/shivarthu/working_directory/shivarthu-client/target/wasm32-unknown-unknown/debug/build/secp256k1-sys-ceedfda36f3d6248/out` (signal: 9, SIGKILL: kill)
2023-08-25T15:27:32.978449Z ERROR  error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
    2: cargo call returned a bad status
Error: error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
```
I have 32 GB of ram, running` trunk serve` consumes all and terminates without producing build.

I am using rustc 1.72.0 (5680fa18f 2023-08-23) 
System: Ubuntu 20.04.2 LTS
Processor: 12th Gen Intel® Core™ i7-12650H × 16
Memory: 32 GiB

It also shows error in rustc 1.71.0
```cargo build --release``` successfully works, but error comes with ``trunk build`` or ```trunk serve``` or just ```cargo build```


Reproducible [code link](https://github.com/amiyatulu/shivarthu_client/tree/5b6e1289a24e9c4823f1fb9d340e7bc5c2538c22)
Please change the src/constants/auth.rs.bak to auth.rs