proxygen
folly::ArenaAllocatorTraits< Alloc > Struct Template Reference

#include <Arena.h>

Static Public Member Functions

static size_t goodSize (const Alloc &, size_t size)
 

Detailed Description

template<class Alloc>
struct folly::ArenaAllocatorTraits< Alloc >

Simple arena: allocate memory which gets freed when the arena gets destroyed.

The arena itself allocates memory using a custom allocator which conforms to the C++ concept Allocator.

http://en.cppreference.com/w/cpp/concept/Allocator

You may also specialize ArenaAllocatorTraits for your allocator type to provide:

size_t goodSize(const Allocator& alloc, size_t size) const; Return a size (>= the provided size) that is considered "good" for your allocator (for example, if your allocator allocates memory in 4MB chunks, size should be rounded up to 4MB). The provided value is guaranteed to be rounded up to a multiple of the maximum alignment required on your system; the returned value must be also.

An implementation that uses malloc() / free() is defined below, see SysArena.

By default, don't pad the given size.

Definition at line 58 of file Arena.h.

Member Function Documentation

template<class Alloc >
static size_t folly::ArenaAllocatorTraits< Alloc >::goodSize ( const Alloc ,
size_t  size 
)
inlinestatic

Definition at line 219 of file Arena.h.

References folly::size().

Referenced by folly::Arena< Alloc >::Block::allocate().

219  {
220  return size;
221  }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45

The documentation for this struct was generated from the following file: