Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ways to specify thread stack size #1008

Open
lihe07 opened this issue Mar 16, 2022 · 1 comment
Open

Ways to specify thread stack size #1008

lihe07 opened this issue Mar 16, 2022 · 1 comment

Comments

@lihe07
Copy link

lihe07 commented Mar 16, 2022

When we are trying to spawn a memory costy task with async-std
async_std::task::spawn(some_future())
It throws thread 'async-std/runtime' has overflowed its stack

Although we can solve this problem with the following code:

thread::Builder::new().stack_size(32 * 1024).spawn(|| {
    async_std::task::block_on(some_future())
}).unwrap();

But if async_std also has the specified task stack size, it can save some time.

@Fishrock123
Copy link
Member

If that future is a large set of async functions you may be able to break it up manually using a pinned box for some memory indirection, which should help I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants