Skip to content

Instantly share code, notes, and snippets.

@pronebird
Last active July 26, 2025 14:27
Show Gist options
  • Select an option

  • Save pronebird/c8877543c58e25718a0f63fc479ff8e8 to your computer and use it in GitHub Desktop.

Select an option

Save pronebird/c8877543c58e25718a0f63fc479ff8e8 to your computer and use it in GitHub Desktop.
Rust: get stack size in bytes on Windows
fn get_stack_size() -> usize {
let mut low: usize = 0;
let mut high: usize = 0;
unsafe {
windows::Win32::System::Threading::GetCurrentThreadStackLimits(
&mut low as _,
&mut high as _,
)
};
high - low
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment