Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(979)

Unified Diff: third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp

Issue 1697263006: If pthread stack size can't be determined, make a conservative guess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync comment Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
diff --git a/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp b/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
index 6b1aa49e119a30e9eb080ec313ef55fbed4a8940..2fc15209c3d8663a448dbc7092d79d88be856e40 100644
--- a/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
+++ b/third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp
@@ -56,7 +56,8 @@ void StackFrameDepth::enableStackLimit()
s_isUsingFallbackStackSize = false;
#endif
- // Windows and OSX platforms will always return a non-zero estimate.
+ // All supported platforms will currently return a non-zero estimate,
+ // except if ASan is enabled.
size_t stackSize = getUnderestimatedStackSize();
if (!stackSize) {
s_stackFrameLimit = getFallbackStackLimit();
@@ -86,7 +87,7 @@ size_t StackFrameDepth::getUnderestimatedStackSize()
#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
// pthread_getattr_np() can fail if the thread is not invoked by
// pthread_create() (e.g., the main thread of webkit_unit_tests).
- // In this case, this method returns 0 and the caller must handle it.
+ // If so, a conservative size estimate is returned.
pthread_attr_t attr;
int error;
@@ -108,7 +109,12 @@ size_t StackFrameDepth::getUnderestimatedStackSize()
pthread_attr_destroy(&attr);
#endif
- return 0;
+ // Return a 512k stack size, (conservatively) assuming the following:
+ // - that size is much lower than the pthreads default (x86 pthreads has a 2M default.)
+ // - no one is running Blink with an RLIMIT_STACK override, let alone as
+ // low as 512k.
+ //
+ return 512 * 1024;
#elif OS(MACOSX)
// pthread_get_stacksize_np() returns too low a value for the main thread on
// OSX 10.9, http://mail.openjdk.java.net/pipermail/hotspot-dev/2013-October/011369.html
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698