Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5d038c3

Browse files
authoredMar 4, 2022
Rollup merge of rust-lang#94618 - lewisclark:remove-stack-size-rounding, r=yaahc
Don't round stack size up for created threads in Windows Fixes rust-lang#94454 Windows does the rounding itself, so there isn't a need to explicity do the rounding beforehand, as mentioned by `@ChrisDenton` in rust-lang#94454 > The operating system rounds up the specified size to the nearest multiple of the system's allocation granularity (typically 64 KB). To retrieve the allocation granularity of the current system, use the [GetSystemInfo](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsysteminfo) function. https://docs.microsoft.com/en-us/windows/win32/procthread/thread-stack-size
2 parents 4066434 + 6843dd5 commit 5d038c3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed
 

‎library/std/src/sys/windows/thread.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ impl Thread {
3030
// PTHREAD_STACK_MIN bytes big. Windows has no such lower limit, it's
3131
// just that below a certain threshold you can't do anything useful.
3232
// That threshold is application and architecture-specific, however.
33-
// Round up to the next 64 kB because that's what the NT kernel does,
34-
// might as well make it explicit.
35-
let stack_size = (stack + 0xfffe) & (!0xfffe);
3633
let ret = c::CreateThread(
3734
ptr::null_mut(),
38-
stack_size,
35+
stack,
3936
thread_start,
4037
p as *mut _,
4138
c::STACK_SIZE_PARAM_IS_A_RESERVATION,

0 commit comments

Comments
 (0)
Please sign in to comment.