Title: [223844] trunk/Source/bmalloc
Revision
223844
Author
[email protected]
Date
2017-10-23 10:56:41 -0700 (Mon, 23 Oct 2017)

Log Message

bmalloc::api::tryLargeMemalignVirtual() shouldn't assert on a failed allocation
https://bugs.webkit.org/show_bug.cgi?id=178654

Reviewed by Geoffrey Garen.

* bmalloc/bmalloc.h:
(bmalloc::api::tryLargeMemalignVirtual): Call Heap::tryAllocateLarge()
instead of Heap::allocateLarge(). The former will return a null pointer
upon a failed allocation, allowing the caller to fail gracefully just as
the API entrypoint implies, while the latter currently provokes a crash
in these circumstances.

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (223843 => 223844)


--- trunk/Source/bmalloc/ChangeLog	2017-10-23 17:51:08 UTC (rev 223843)
+++ trunk/Source/bmalloc/ChangeLog	2017-10-23 17:56:41 UTC (rev 223844)
@@ -1,3 +1,17 @@
+2017-10-23  Zan Dobersek  <[email protected]>
+
+        bmalloc::api::tryLargeMemalignVirtual() shouldn't assert on a failed allocation
+        https://bugs.webkit.org/show_bug.cgi?id=178654
+
+        Reviewed by Geoffrey Garen.
+
+        * bmalloc/bmalloc.h:
+        (bmalloc::api::tryLargeMemalignVirtual): Call Heap::tryAllocateLarge()
+        instead of Heap::allocateLarge(). The former will return a null pointer
+        upon a failed allocation, allowing the caller to fail gracefully just as
+        the API entrypoint implies, while the latter currently provokes a crash
+        in these circumstances.
+
 2017-10-19  Saam Barati  <[email protected]>
 
         Runtime disable gigacage on iOS because it broke WasmBench

Modified: trunk/Source/bmalloc/bmalloc/bmalloc.h (223843 => 223844)


--- trunk/Source/bmalloc/bmalloc/bmalloc.h	2017-10-23 17:51:08 UTC (rev 223843)
+++ trunk/Source/bmalloc/bmalloc/bmalloc.h	2017-10-23 17:56:41 UTC (rev 223844)
@@ -71,7 +71,7 @@
     kind = mapToActiveHeapKind(kind);
     Heap& heap = PerProcess<PerHeapKind<Heap>>::get()->at(kind);
     std::lock_guard<StaticMutex> lock(Heap::mutex());
-    return heap.allocateLarge(lock, alignment, size, AllocationKind::Virtual);
+    return heap.tryAllocateLarge(lock, alignment, size, AllocationKind::Virtual);
 }
 
 inline void free(void* object, HeapKind kind = HeapKind::Primary)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to