Module: wine
Branch: master
Commit: 9e5d54eac4085fa90049a6f52749ae78b86b05b6
URL:
https://gitlab.winehq.org/wine/wine/-/commit/9e5d54eac4085fa90049a6f52749ae…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Feb 8 03:43:27 2023 +0100
ntdll/tests: Minimize the stack size for test_tp_multi_wait().
This test creates 512 threads so the default 2 MB stack size requires
1 GB which can cause out-of-virtual-memory-space issues. So cause
threadpool to use the smallest possible stack size, which should be
1 MB, halving the virtual memory usage.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54064
---
dlls/ntdll/tests/threadpool.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c
index a7457e0a315..d8ca80a99a4 100644
--- a/dlls/ntdll/tests/threadpool.c
+++ b/dlls/ntdll/tests/threadpool.c
@@ -1898,6 +1898,7 @@ static void CALLBACK multi_wait_cb(TP_CALLBACK_INSTANCE *instance,
void *userdat
static void test_tp_multi_wait(void)
{
+ TP_POOL_STACK_INFORMATION stack_info;
TP_CALLBACK_ENVIRON environment;
HANDLE semaphores[512];
TP_WAIT *waits[512];
@@ -1917,6 +1918,11 @@ static void test_tp_multi_wait(void)
status = pTpAllocPool(&pool, NULL);
ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
+ /* many threads -> use the smallest stack possible */
+ stack_info.StackReserve = 256 * 1024;
+ stack_info.StackCommit = 4 * 1024;
+ status = pTpSetPoolStackInformation(pool, &stack_info);
+ ok(!status, "TpQueryPoolStackInformation failed: %lx\n", status);
memset(&environment, 0, sizeof(environment));
environment.Version = 1;