I am trying to run all of the tests in the substrate codebase. When the pc gets to the 1670th dependency it freezes. All of my RAM is being used and the pc won't respond. I have 16GB of RAM, Ryzen 5 2600x and I am running ubuntu 20.04.

3 Answers 3


You probably need more RAM, 32GB should be good.
Otherwise you can reduce the number of threads that it compiles on with:
cargo test -j 4.
It is also possible to only test one create:
cargo test -p sp-arithmetic.

  • Polytope labs has been working on the solution on compiling the substrate in the cloud. cargo-cloud and prolly soon it will be available for the community May 22, 2022 at 14:37

An alternative to increasing your RAM is to increase your swap space using available hard disk space on Linux, although swap space is slower than using RAM. I always do this when using a cloud provider, especially when in development environment since I find it cheaper to buy extra volumes of block storage for slower testing using swap space than to buy an instance with a faster CPU and RAM than I need.

Check your free hard disk space with:

df -H

Check your swap space with:

free -h

Show the swap file and amount of swap available and being used:

sudo swapon --show

An example of increasing swap space by 10Gb would involve removing an existing swapfile (if any), adding for example 10Gb (10240) swap space (assuming you have at least that amount of free hard disk space), then creating the swapfile, turning on swap space, and finally verifying that the swap space has increased:

sudo swapoff /swap_file
sudo rm /swap_file
sudo dd if=/dev/zero of=/swap_file bs=10240 count=1M
sudo chmod 600 /swap_file
sudo mkswap /swap_file
sudo swapon /swap_file
free -h

Lastly enable swap space usage at boot time by editing the /etc/fstab file (i.e. with Vim sudo vim /etc/fstab), then copy/paste the below (single line) to bottom of that file and save it

/swapfile       none            swap    defaults,discard                0 0

Also run the tests with --release mode on. That will run the tests more efficiently.

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.