Summary:
* folly/test/AtomicHashArrayTest.cpp (MmapAllocator):
Upon failure, mmap returns MAP_FAILED, not NULL.
Test Plan:
fbconfig -r folly/test:atomic_hash_array_test && fbmake runtests
Reviewed By: mwang@fb.com
FB internal diff:
D1481080
Tasks:
4846893
T *allocate(size_t n) {
void *p = mmap(nullptr, n * sizeof(T), PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
- if (!p) throw std::bad_alloc();
+ if (p == MAP_FAILED) throw std::bad_alloc();
return (T *)p;
}