Title: [218800] trunk/Source/WTF
Revision
218800
Author
[email protected]
Date
2017-06-25 14:41:51 -0700 (Sun, 25 Jun 2017)

Log Message

initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
https://bugs.webkit.org/show_bug.cgi?id=173720

Reviewed by Mark Lam.

When using std::numeric_limits<size_t>::max() for global variable's initialization,
it seems that it invokes static constructor to initialize this in VC++.
We avoid this edge case by introducing a workaround using SIZE_MAX here.

When I perform git-grep, there is only one site (this) using std::numeric_limits<>::xxx()
to initialize global variable.

* wtf/FastMalloc.cpp:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (218799 => 218800)


--- trunk/Source/WTF/ChangeLog	2017-06-25 20:35:34 UTC (rev 218799)
+++ trunk/Source/WTF/ChangeLog	2017-06-25 21:41:51 UTC (rev 218800)
@@ -1,3 +1,19 @@
+2017-06-25  Yusuke Suzuki  <[email protected]>
+
+        initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
+        https://bugs.webkit.org/show_bug.cgi?id=173720
+
+        Reviewed by Mark Lam.
+
+        When using std::numeric_limits<size_t>::max() for global variable's initialization,
+        it seems that it invokes static constructor to initialize this in VC++.
+        We avoid this edge case by introducing a workaround using SIZE_MAX here.
+
+        When I perform git-grep, there is only one site (this) using std::numeric_limits<>::xxx()
+        to initialize global variable.
+
+        * wtf/FastMalloc.cpp:
+
 2017-06-25  Konstantin Tokarev  <[email protected]>
 
         Remove excessive headers from _javascript_Core

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (218799 => 218800)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2017-06-25 20:35:34 UTC (rev 218799)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2017-06-25 21:41:51 UTC (rev 218800)
@@ -48,7 +48,9 @@
 
 #if !defined(NDEBUG)
 namespace {
-size_t maxSingleAllocationSize = std::numeric_limits<size_t>::max();
+// We do not use std::numeric_limits<size_t>::max() here due to the edge case in VC++.
+// https://bugs.webkit.org/show_bug.cgi?id=173720
+static size_t maxSingleAllocationSize = SIZE_MAX;
 };
 
 void fastSetMaxSingleAllocationSize(size_t size)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to