#include <AtomicUnorderedMapUtils.h>
Definition at line 30 of file AtomicUnorderedMapUtils.h.
void* folly::detail::MMapAlloc::allocate |
( |
size_t |
size | ) |
|
|
inline |
Definition at line 41 of file AtomicUnorderedMapUtils.h.
References computeSize(), and MAP_POPULATE.
45 #if defined(MAP_POPULATE) 50 void* mem =
static_cast<void*
>(mmap(
53 PROT_READ | PROT_WRITE,
54 MAP_PRIVATE | MAP_ANONYMOUS | extraflags,
57 if (mem == reinterpret_cast<void*>(-1)) {
58 throw std::system_error(errno, std::system_category());
60 #if !defined(MAP_POPULATE) && defined(MADV_WILLNEED) 61 madvise(mem,
size, MADV_WILLNEED);
constexpr auto size(C const &c) -> decltype(c.size())
size_t computeSize(size_t size)
size_t folly::detail::MMapAlloc::computeSize |
( |
size_t |
size | ) |
|
|
inlineprivate |
Definition at line 32 of file AtomicUnorderedMapUtils.h.
Referenced by allocate(), and deallocate().
33 long pagesize = sysconf(_SC_PAGESIZE);
34 size_t mmapLength = ((
size - 1) & ~(pagesize - 1)) + pagesize;
35 assert(
size <= mmapLength && mmapLength <
size + pagesize);
36 assert((mmapLength % pagesize) == 0);
constexpr auto size(C const &c) -> decltype(c.size())
void folly::detail::MMapAlloc::deallocate |
( |
void * |
p, |
|
|
size_t |
size |
|
) |
| |
|
inline |
The documentation for this class was generated from the following file: