Bug 1376873 - Reduce thread stack size in platform_thread.cc; r=bwc
authorDan Minor <dminor@mozilla.com>
Mon, 05 Nov 2018 10:33:02 -0500
changeset 504532 e83c311e5293902be4db4ecea17cff87c633f7cf
parent 504531 8d68d175a589e3aba08e4fbb2bc83125b811a66c
child 504533 1f47cb09f1e64ffa9d530235eb8cfb0b3ae65f3c
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1376873
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1376873 - Reduce thread stack size in platform_thread.cc; r=bwc Summary: The current default stack size of 1M results in intermittent OOMs on win32 builds while running web-platform tests. The value of 256k was chosen for consistency with the default value used elsewhere in Gecko, which is defined in nsIThreadManager.idl. Reviewers: bwc Tags: #secure-revision Bug #: 1376873 Differential Revision: https://phabricator.services.mozilla.com/D11090
media/webrtc/trunk/webrtc/rtc_base/platform_thread.cc
--- a/media/webrtc/trunk/webrtc/rtc_base/platform_thread.cc
+++ b/media/webrtc/trunk/webrtc/rtc_base/platform_thread.cc
@@ -226,24 +226,26 @@ void PlatformThread::Start() {
   RTC_DCHECK(thread_checker_.CalledOnValidThread());
   RTC_DCHECK(!thread_) << "Thread already started?";
 #if defined(WEBRTC_WIN)
   stop_ = false;
 
   // See bug 2902 for background on STACK_SIZE_PARAM_IS_A_RESERVATION.
   // Set the reserved stack stack size to 1M, which is the default on Windows
   // and Linux.
-  thread_ = ::CreateThread(nullptr, 1024 * 1024, &StartThread, this,
+  // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
+  thread_ = ::CreateThread(nullptr, 256 * 1024, &StartThread, this,
                            STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id_);
   RTC_CHECK(thread_) << "CreateThread failed";
   RTC_DCHECK(thread_id_);
 #else
   ThreadAttributes attr;
   // Set the stack stack size to 1M.
-  pthread_attr_setstacksize(&attr, 1024 * 1024);
+  // Mozilla: Set to 256kb for consistency with nsIThreadManager.idl
+  pthread_attr_setstacksize(&attr, 256 * 1024);
   RTC_CHECK_EQ(0, pthread_create(&thread_, &attr, &StartThread, this));
 #endif  // defined(WEBRTC_WIN)
 }
 
 bool PlatformThread::IsRunning() const {
   RTC_DCHECK(thread_checker_.CalledOnValidThread());
 #if defined(WEBRTC_WIN)
   return thread_ != nullptr;