Home > Blockchain >  How to increase stack size of threads used by `cargo test`?
How to increase stack size of threads used by `cargo test`?

Time:12-01

I have a program that uses a large amount of stack. I use Linux, and so have already set the stack size limit via ulimit -s 1048576.

Running cargo test -- --test-threads 1 works as expected, but when I use more than one thread, e.g. cargo test -- --test-threads 2, I get fatal runtime error: stack overflow. I believe this is because the Rust thread default stack size, used when running tests, is too small.

How do I increase this stack size when running cargo test?

CodePudding user response:

Found it: RUST_MIN_STACK, as in RUST_MIN_STACK=104857600 cargo test.

CodePudding user response:

Using stacker you are able to increase the size of threads

  • Related