Skip to content

rt: Release big stacks immediately after use to avoid holding on to them... - #6581

Closed
brson wants to merge 1 commit into
rust-lang:incomingfrom
brson:stack
Closed

rt: Release big stacks immediately after use to avoid holding on to them...#6581
brson wants to merge 1 commit into
rust-lang:incomingfrom
brson:stack

Conversation

@brson

Copy link
Copy Markdown
Contributor

... through yields

r? @pcwalton

This avoids the following pathological scenario that makes threadring OOM:

  1. task calls C using fast_ffi, borrowing a big stack from the scheduler.
  2. task returns from C and places the big stack on the task-local stack segment list
  3. task calls further Rust functions that require growing the stack, and for this reuses the big stack
  4. task yields, failing to return the big stack to the scheduler.
  5. repeat 500+ times and OOM

Fixes#5985

…hem through yields
This avoids the following pathological scenario that makes threadring OOM:
1) task calls C using fast_ffi, borrowing a big stack from the scheduler.
2) task returns from C and places the big stack on the task-local stack segment list
3) task calls further Rust functions that require growing the stack, and for this reuses the big stack
4) task yields, failing to return the big stack to the scheduler.
5) repeat 500+ times and OOM
@graydongraydon closed this Jun 13, 2013
@ThiezThiez mentioned this pull request Jun 17, 2013
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
6577: fix typos in syntax.md r=matklad a=jakobhellermann
6579: cargo update and add new license r=matklad a=kjeremy
6581: Use vscode-languageclient 7.0.0-next.14 r=matklad a=kjeremy
Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@brson@pcwalton@bors@graydon