points by Koshkin 6 years ago

Hm. Rust needs more than 4GB to compile itself?

qayxc 6 years ago

Address space ≠ required RAM.

  • Conan_Kudo 6 years ago

    It does require more than 4GB of RAM during its own build, though.

    • qayxc 6 years ago

      That's simply not true. After I couldn't find any such requirement in the build instructions for Rust, I was curious and actually setup a VM with 4GB of RAM (3.8GB usable), checked out the current rust source tree and had my machine compile the whole shebang in the background.

      And what can I say - after about 3 hours and max memory usage of about 31% (or a little less than 1.8GB) the compile finished without errors.

      So could you please point me to the source of your claim? Did I just uncover some magic loophole that allowed me to achieve this feat while using less than 2GB of RAM? What did I do wrong/right?

      • Conan_Kudo 6 years ago

        We regularly hit memory exhaustion when building Rust on Fedora and openSUSE for 32-bit architectures. It's even worse for openSUSE since we wind up having to build LLVM at times too. What you're probably missing is building the debug symbols. A release build with no debug symbols will likely be fine.

        See: https://github.com/rust-lang/rust/issues/45854

        • qayxc 6 years ago

          No you don't hit memory exhaustion. You hit address space exhaustion. There's a difference and it's an important one, because 64-bit architectures don't suffer from this.

          Your builds don't need more memory, they need more address space. You can convince me otherwise by enabling PAE and still running into the issue. Until then I stand by my point.

          • Koshkin 6 years ago

            You are not wrong, but note that "memory" is not just RAM, it is also the disk space that is needed for swapping pages in and out. So, the required address space you keep referring to is not some cost-less abstraction; rather, it does in fact correspond to some physical bytes - no matter where they reside at a given particular moment, and it looks like the thing does actually need more than 4G of those.