Skip to main content

current_thread_committed_stack_bytes

Function current_thread_committed_stack_bytes 

Source
pub fn current_thread_committed_stack_bytes() -> Option<usize>
Expand description

Returns how many bytes of the calling thread’s stack are committed.

Windows commits a thread stack one page at a time as it grows and keeps those pages until the thread exits, so the value is the deepest stack use of the thread so far, rounded up to whole pages. A process entrypoint can read it just before returning to measure the headroom left on the main thread, whose size the runtime cannot choose.

Returns None on other platforms, or if the stack layout cannot be read.