proxygen
|
#include <ThreadCachedArena.h>
Classes | |
struct | ThreadLocalPtrTag |
Public Member Functions | |
ThreadCachedArena (size_t minBlockSize=SysArena::kDefaultMinBlockSize, size_t maxAlign=SysArena::kDefaultMaxAlign) | |
void * | allocate (size_t size) |
void | deallocate (void *, size_t=0) |
size_t | totalSize () const |
Private Member Functions | |
ThreadCachedArena (const ThreadCachedArena &)=delete | |
ThreadCachedArena (ThreadCachedArena &&)=delete | |
ThreadCachedArena & | operator= (const ThreadCachedArena &)=delete |
ThreadCachedArena & | operator= (ThreadCachedArena &&)=delete |
SysArena * | allocateThreadLocalArena () |
void | zombify (SysArena &&arena) |
Private Attributes | |
const size_t | minBlockSize_ |
const size_t | maxAlign_ |
ThreadLocalPtr< SysArena, ThreadLocalPtrTag > | arena_ |
Synchronized< SysArena > | zombies_ |
Thread-caching arena: allocate memory which gets freed when the arena gets destroyed.
The arena itself allocates memory using malloc() in blocks of at least minBlockSize bytes.
For speed, each thread gets its own Arena (see Arena.h); when threads exit, the Arena gets merged into a "zombie" Arena, which will be deallocated when the ThreadCachedArena object is destroyed.
Definition at line 39 of file ThreadCachedArena.h.
|
explicit |
|
privatedelete |
|
privatedelete |
|
inline |
Definition at line 45 of file ThreadCachedArena.h.
References folly::Arena< Alloc >::allocate(), allocateThreadLocalArena(), arena_, and UNLIKELY.
Referenced by TEST().
|
private |
Definition at line 26 of file ThreadCachedArena.cpp.
References arena_, folly::Arena< SysAllocator< void > >::kNoSizeLimit, maxAlign_, minBlockSize_, mode, folly::gen::move, folly::pushmi::detail::t, folly::THIS_THREAD, folly::pushmi::__adl::tp, and zombify().
Referenced by allocate().
|
inline |
Definition at line 54 of file ThreadCachedArena.h.
References totalSize().
|
privatedelete |
|
privatedelete |
size_t folly::ThreadCachedArena::totalSize | ( | ) | const |
Definition at line 43 of file ThreadCachedArena.cpp.
References arena_, ThreadCachedArena(), and zombies_.
Referenced by deallocate(), and TEST().
|
private |
Definition at line 39 of file ThreadCachedArena.cpp.
References folly::gen::move, and zombies_.
Referenced by allocateThreadLocalArena().
|
private |
Definition at line 78 of file ThreadCachedArena.h.
Referenced by allocate(), allocateThreadLocalArena(), and totalSize().
|
private |
Definition at line 76 of file ThreadCachedArena.h.
Referenced by allocateThreadLocalArena().
|
private |
Definition at line 75 of file ThreadCachedArena.h.
Referenced by allocateThreadLocalArena().
|
private |
Definition at line 81 of file ThreadCachedArena.h.
Referenced by totalSize(), and zombify().