From 582eaaaa68f0741817b459bb9d320ba476082d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 6 Sep 2024 15:04:06 +0200 Subject: [PATCH] tst_bench_qobject: Fix stdAllocator case for Windows The total stack space available is 1MB, but each pointer is 8 bytes. So we have to limit the amount of pointers we allocate on the stack to somewhere below 128K. Pick-to: 6.7 6.5 Change-Id: I1d1262a4048cf4b3fed8df813decc3e142430a32 Reviewed-by: Mate Barany (cherry picked from commit b2e0ff4bca5d81205c8425cdc528e5c2a2988172) Reviewed-by: Qt Cherry-pick Bot --- .../corelib/kernel/qobject/tst_bench_qobject.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.cpp b/tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.cpp index 99c15f6317b..6ea09171121 100644 --- a/tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.cpp +++ b/tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.cpp @@ -59,7 +59,13 @@ inline void allocator() // prepare OS (no other tasks, CPU and RAM reservations) to run this test, or use // instruction counting which seems to be less fragile. - const int count = 256 * 1024; +#ifdef Q_OS_WIN + // Stack space available is 1MB, but each pointer is 8 bytes, so leave us + // 32KB space to work with: + constexpr int count = 124 * 1024; +#else + constexpr int count = 256 * 1024; +#endif QScopedPointer objects[count]; QBENCHMARK_ONCE {