diff --git a/util/simple_heap.h b/util/simple_heap.h index 1181682fa0..1fb992eb63 100644 --- a/util/simple_heap.h +++ b/util/simple_heap.h @@ -208,8 +208,11 @@ template class SimpleHeap { cache_size_ -= size; } else { // Alloc new block - new block may be larger than default. void* ptr = block_allocator_.alloc(bytes, size); + if (ptr == nullptr) { + fprintf(stderr, "Block allocation failed, Allocator is expected to throw.\n"); + return nullptr; + } base = reinterpret_cast(ptr); - assert(ptr != nullptr && "Block allocation failed, Allocator is expected to throw."); } in_use_size_ += size;