I use archlinux on x64_64 CPU architecture. Steps to reproduce:

  1. git clone https://github.com/paritytech/substrate
  2. cd substrate
  3. cargo test

it runs up until 1600/1706. And I did it carefully with pauses (ctrl+Z and fg 1) to make sure the CPU doesn't overheat. And with relatively cold CPU, my computer crashed at exactly package/unit 1600.

How do I solve this? I really would like to contribute to Substrate's development but can't do it if it crashes all the time

2 Answers 2


I agree with @bkchr.

And there is an easy way.

Increasing your swap space.

I'm on Archlinux too, and I encountered this a few weeks ago. At that time, I was trying to run cargo build --workspace --all-features --all-targets. And this takes around 100G RAM.

Finally, I solved this by increasing the swap space.

BTW, you could also compile it with --release. This will take more time but it will optimize the size and low down the memory usage significantly.

  • --release will take much more memory while compiling, because release builds are doing much more optimizations. The memory usage here is while building and not while running the final binary.
    – bkchr
    Commented Dec 1, 2022 at 13:57
  • Interesting, if I remove the --release I can't finish the compiling. And I think the worst part is the final library linking. IIUC, If we use --release, the linking size/usage will be decreased. As he said, he stucked at 1600/1706, I think the compiler was processing the linking at that time.
    – AurevoirXavier
    Commented Dec 1, 2022 at 14:15
  • Hmm interesting, I would think that --release takes more memory :P Maybe later in the build order. Nevertheless, the proper solution here is still the ramdisk/swap.
    – bkchr
    Commented Dec 1, 2022 at 14:51
  • I managed to get to the end of cargo test. Thanks for help. I didn't pass all the tests though, but I guess that's a separate issue
    – amab8901
    Commented Dec 1, 2022 at 15:39

You need more RAM. You could add some ramdisk to have more RAM and finish the build. The last step your compilation is "crashing your computer" is the linking that requires quite a lot of RAM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.