简体   繁体   English

如何增加 `cargo test` 使用的线程的堆栈大小?

[英]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时如何增加堆栈大小?

Found it : RUST_MIN_STACK , as in RUST_MIN_STACK=104857600 cargo test .找到它RUST_MIN_STACK ,如RUST_MIN_STACK=104857600 cargo test

Using stacker you are able to increase the size of threads使用stacker你可以增加线程的大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM