18 #define FOLLY_ARENA_H_ 25 #include <boost/intrusive/slist.hpp> 57 template <
class Alloc>
59 template <
class Alloc>
76 folly::to<std::string>(
"Invalid maxAlign: ",
maxAlign_)));
129 typedef boost::intrusive::slist_member_hook<boost::intrusive::tag<Arena>>
139 static std::pair<Block*, size_t>
144 return reinterpret_cast<char*
>(
this + 1);
163 return isAligned(reinterpret_cast<uintptr_t>(p));
173 typedef boost::intrusive::slist<
175 boost::intrusive::member_hook<Block, BlockLink, &Block::link>,
176 boost::intrusive::constant_time_size<false>,
177 boost::intrusive::cache_last<true>>
211 template <
class Alloc>
217 template <
class Alloc>
246 template <
typename T,
typename Alloc>
249 template <
typename T>
Arena & operator=(const Arena &)=delete
const Alloc & alloc() const
static constexpr size_t kNoSizeLimit
—— Concurrent Priority Queue Implementation ——
static size_t goodSize(const Alloc &, size_t size)
bool_constant< true > true_type
SysArena(size_t minBlockSize=kDefaultMinBlockSize, size_t sizeLimit=kNoSizeLimit, size_t maxAlign=kDefaultMaxAlign)
void merge(Arena &&other)
static constexpr size_t kBlockOverhead
constexpr auto size(C const &c) -> decltype(c.size())
size_t totalAllocatedSize_
void * allocateSlow(size_t size)
static constexpr size_t kDefaultMinBlockSize
boost::intrusive::slist< Block, boost::intrusive::member_hook< Block, BlockLink,&Block::link >, boost::intrusive::constant_time_size< false >, boost::intrusive::cache_last< true > > BlockList
bool isAligned(void *p) const
static size_t goodSize(const SysAllocator< void > &, size_t size)
AllocAndSize allocAndSize_
static constexpr size_t kDefaultMaxAlign
bool isAligned(uintptr_t address) const
boost::intrusive::slist_member_hook< boost::intrusive::tag< Arena > > BlockLink
void deallocate(void *, size_t=0)
void * allocate(size_t size)
size_t roundUp(size_t size) const
Arena(const Alloc &alloc, size_t minBlockSize=kDefaultMinBlockSize, size_t sizeLimit=kNoSizeLimit, size_t maxAlign=kDefaultMaxAlign)
size_t minBlockSize() const
AllocAndSize(const Alloc &a, size_t s)
FOLLY_NOINLINE FOLLY_COLD void throw_exception(Ex &&ex)
size_t goodMallocSize(size_t minSize) noexcept