1 From: Dan Minor <dminor@mozilla.com>
2 Date: Mon, 5 Nov 2018 10:33:00 -0500
3 Subject: Bug 1376873 - Reduce thread stack size in platform_thread.cc; r=bwc
6 The current default stack size of 1M results in intermittent OOMs on win32
7 builds while running web-platform tests. The value of 256k was chosen for
8 consistency with the default value used elsewhere in Gecko, which is defined in
13 Tags: #secure-revision
17 Differential Revision: https://phabricator.services.mozilla.com/D11090
18 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/e83c311e5293902be4db4ecea17cff87c633f7cf
20 rtc_base/platform_thread.cc | 6 ++++--
21 1 file changed, 4 insertions(+), 2 deletions(-)
23 diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
24 index 6d369d747e..556204ac89 100644
25 --- a/rtc_base/platform_thread.cc
26 +++ b/rtc_base/platform_thread.cc
27 @@ -189,15 +189,17 @@ PlatformThread PlatformThread::SpawnThread(
28 // Set the reserved stack stack size to 1M, which is the default on Windows
31 + // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
32 PlatformThread::Handle handle = ::CreateThread(
33 - nullptr, 1024 * 1024, &RunPlatformThread, start_thread_function_ptr,
34 + nullptr, 256 * 1024, &RunPlatformThread, start_thread_function_ptr,
35 STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id);
36 RTC_CHECK(handle) << "CreateThread failed";
39 pthread_attr_init(&attr);
40 // Set the stack stack size to 1M.
41 - pthread_attr_setstacksize(&attr, 1024 * 1024);
42 + // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
43 + pthread_attr_setstacksize(&attr, 256 * 1024);
44 pthread_attr_setdetachstate(
45 &attr, joinable ? PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED);
46 PlatformThread::Handle handle;