Skip to content

Commit

Permalink
Merge r223844 - bmalloc::api::tryLargeMemalignVirtual() shouldn't ass…
Browse files Browse the repository at this point in the history
…ert 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.
  • Loading branch information
zdobersek authored and carlosgcampos committed Oct 27, 2017
1 parent 54bff41 commit e4f41c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Source/bmalloc/ChangeLog
@@ -1,3 +1,17 @@
2017-10-23 Zan Dobersek <zdobersek@igalia.com>

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-05 Filip Pizlo <fpizlo@apple.com>

Use one Scavenger thread for all Heaps
Expand Down
2 changes: 1 addition & 1 deletion Source/bmalloc/bmalloc/bmalloc.h
Expand Up @@ -70,7 +70,7 @@ inline void* tryLargeMemalignVirtual(size_t alignment, size_t size, HeapKind kin
{
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)
Expand Down

0 comments on commit e4f41c7

Please sign in to comment.