rustup icon indicating copy to clipboard operation
rustup copied to clipboard

RUSTUP_UNPACK_RAM seems not too work but is still documented

Open fishrockz opened this issue 3 years ago • 4 comments

Problem

rustup advertises RUSTUP_UNPACK_RAM in https://rust-lang.github.io/rustup/environment-variables.html?highlight=ram#environment-variables

but it seems to do nothing

Steps

  1. rm -rf ~/.rustup
  2. export RUSTUP_UNPACK_RAM=33554432;
  3. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  4. watch htop use about 150MBs ,quite hard to note like this. but on laptop 1.4Gb up to about 1.6Gb, on pi starting with 75MB of 428MB and seems to use all of it. both cases are way more than 33MB

Possible Solution(s)

It could be that I'm doing something stupid but given it seems to happen on more than one device i feel that something is possibly wrong.

Notes

This is blocking the ability to install on small ram systems like rasp-pi-zero-2

Also if RUSTUP_UNPACK_RAM is too small or not parsable then rust up just keep going and crashes your system. To my mind it would be loads better to stop rather than continue.

Rustup version

[will@localhost ~]$ rustup --version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.57.0 (f1edd0429 2021-11-29)`
[will@localhost ~]$

Installed toolchains

[will@localhost ~]$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/will/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.57.0 (f1edd0429 2021-11-29)

fishrockz avatar Dec 07 '21 19:12 fishrockz

So there's a number of potential things here.

  1. htop may be reporting VM size which is not the same as RAM usage. If so, it's very likely overreporting.
  2. The rustup process is likely using more RAM for things other than unpacking, so it will never be as low as the 32M you set.
  3. As for crashing, I'm not sure why we're using a signficant quantity over the expected usage, we should stay fairly low in general, but perhaps memory fragmentation is causing a problem.

kinnison avatar Dec 08 '21 15:12 kinnison

A bit of a necro, but I was able to install rustc on a 512MB RAM OrangePi (4 cores) by also setting RUSTUP_IO_THREADS=1.

Prior to this, rustup would take 300MiB of RAM then get killed by the OOM killer. With this, the limit seems to be respected a lot more closely.

mon avatar Dec 04 '22 13:12 mon