[英]How to increase stack size of threads used by `cargo test`?
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
.我使用 Linux,因此已经通过
ulimit -s 1048576
设置了堆栈大小限制。
Running cargo test -- --test-threads 1
works as expected, but when I use more than one thread, eg cargo test -- --test-threads 2
, I get fatal runtime error: stack overflow
.运行
cargo test -- --test-threads 1
按预期工作,但是当我使用多个线程时,例如cargo test -- --test-threads 2
,我得到fatal runtime error: stack overflow
。 I believe this is because the Rust thread default stack size, used when running tests, is too small.我相信这是因为运行测试时使用的 Rust 线程默认堆栈大小太小了。
How do I increase this stack size when running cargo test
?运行
cargo test
时如何增加堆栈大小?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.